tortoisegit 101 -- with github and tfstrinug.pbworks.com/w/file/fetch/67900854/tortoisegit.pdf · 4...
TRANSCRIPT
1
Author: Ian Zhang
Date: 2013
TortoiseGit 101
-- with GitHub and TFS
2
Background
• Git is developed by Linus Torvald around 2005 for Linux.
• Git has strong Unix culture. Most of the power GIT commands are
executed in command line.
• Some GUI developers are not familiar with command line commands.
• TortoiseGit provides a GUI client for Git server. It is integrated with
Windows File Explorer.
• GitHub is a hosted Git server and very popular among open source
community.
• This document is to provide a basic tutorial to use TortoiseGit with
GitHub.
3
Installation
4
Installation
• To use TortoiseGit, you need to install following:
o msysgit (GIT for Windows)
o TortoiseGit
• You may find detail information from following page:
http://code.google.com/p/tortoisegit/
5
Step 1: Install msysgit
• http://code.google.com/p/msysgit/downloads/list?can=2&q=“Full+install
er+for+official+Git+for+Windows”
• Pick the latest version.
6
Step 1: Install msysgit
• Follow most of default selections.
• In configuring the line ending conversions (picture 5), I change it to
“Checkout as-is, commit Unix-style line ends” since I am more generic.
7
Step 2: Install Tortoisegit
• http://code.google.com/p/tortoisegit/wiki/Download
• Pick 32 bit or 64 bit version according to your OS.
8
Step 2: Install Tortoisegit
• Follow all default selections.
• In configuring the line ending conversions (picture 5), I change it to
“Checkout as-is, commit Unix-style line ends” since it is more generic.
9
Connect GitHub with TortoiseGit
10
Create remote GitHub Repository: (skip this step if you use existing GitHub repository)
• Go to github.com and create a github account if you don’t have one.
• Click “Create a Repository” link
11
Create remote GitHub Repository (continue)
• Name the repository and click “Create repository” button.
12
Create remote GitHub Repository (continue)
• Name the repository and click “Create repository” button.
13
Clone remote repository to your machine
• The purpose of this step is to clone the repository from remote server
to your local machine.
• The concept is quite different from traditional centralized version
control system.
• All the codes will be downloaded to your local machine.
• All branches and tags will be downloaded to your local machine.
• All history will be downloaded to your local machine.
• Download all your company last 10 years codes to your local
machine? That is Git.
14
Clone remote repository to your machine
• Step 1: Create a normal folder (myrepo) on your local machine.
• Step 2: Click myrepo’s context menu and select “Git Clone”.
15
Clone remote repository to your machine
• Step 3: From GitHub page, copy repository root URL.
• Step 4: Paste the repository root URL to the TortoiseGit popup on
your local machine. Uncheck “Load Putty Key” and click OK
16
Add new project
17
Start New Project:
• You have created a folder “myrepo” on your local machine.
• You have created a project repository on github (TriNutProj).
• Add your code files in your folder myrepo / TriNutProj.
• Create a “.gitignore” file for your project (optional). The purpose of .gitignore
file is to ignore certain type of files (e.g. obj file and exe file).
18
Add new project to repository
• Project -> context menu-> TortoiseGit -> Add
19
Add new project to repository
• Select files to add.
20
Add new project to repository
• Hit Commit button
21
Add new project to repository
• Add comments and hit OK button.
22
Push to GitHub Server
• Project -> Context Menu -> Git Sync
23
Push to GitHub Server
• Hit Push Button
24
Push to GitHub Server
• After you provide github username and password. You should have success.
25
Basic use of TortoiseGit
26
Git Development Workflow:
Clone remote
repository
Pull recent code
from remote Edit code/Build
Add to staging area
Commit to local
repository
Pull to sync remote Local build
successful
Push to remote
repository
27
Developer’s daily life
1. Pull remote repository (optional)
2. Edit the file / Add new files.
3. Local build
4. Add the changed files to staging area
5. Commit files to local repository to create a local milestone.
6. Repeat step 2 to step 5 if needed.
7. Push the change to central repository
1) Pull the remote repository.
2) Merge the conflict
3) Local build and fix the error
4) Push to remote repository.
28
Pull from GitHub
• The purpose of “Pull” operation is to get other people’s check in.
• Git “Pull” operation is the combination of Git “Fetch” operation and “Merge”
operation.
• Project -> context menu -> Git Sync -> Pull
29
Change and Commit files.
• In Git, you don’t need to check out file to change the content.
• You can use any editor to change files.
• When you commit the change. You need Add new file to the git, then commit.
• After commit, it is only in your local repository. It is a local milestone.
30
Push the change to github server.
• In order for other people to see the change, you need to push the change(s) to
github server.
31
Next steps:
Git is a very power full tool. This tutorial only cover basic operation. In order to
use Git correctly and efficiently, you need to consult with your configuration
manager and system architect for following:
• Repository strategy
• Branch and release strategy
• How to connect Git to code review tool and automatically build.
• How to revert a change.
32
Use TortoiseGit with TFS-GIT
33
Why TFS-GIT
• Just like Apple fans, Microsoft developers “love” TFS.
• TFS is very popular in Microsoft development paradigm. But it is very
unpopular outside.
• TFS is tied with Visual Studio. Add Java, Perl script and other files to Visual
Studio?
• Outside world > Microsoft world. Big companies normally do not depend on
one vendor.
• Therefore, it comes with TFS-GIT.
• You can use TFS-GIT within the Visual Studio for Microsoft project.
• You can use normal Git client to connect TFS-Git.
• We will describe how to connect TortoiseGit to TFS-Git. You can use this
strategy to cover both Microsoft development and non-Microsoft development
(e.g. Java, Perl, etc.).
34
Create TFS-Git Project
• Go to http://tfs.visualstudio.com/en-us/tfs-welcome.aspx
• Create a free account.
• In your page, create a new team project using TFS-Git template.
35
Enable TFS-Git for TortoiseGit
• In order to use TortoiseGit with TFS-Git, you need to enable "Alternative
Authentication Credentials" in TFS server.
1. Click Your name on the right.
2. Go to My Profile
3. Click on the Credentials tab
4. Set up an alternate username doesn't include the @ character
5. Now when you connect to the remote repo via TortoiseGit in normal way.
36
My Blackberry 10 project on TFS
This is my bb10 project on TFS. No Visual Studio is needed.