/*
Author: Jiangong SUN
*/
"GIT: is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency."
- from git-scm.com
Here I want to introduce how to configure and use Git with visual studio 2012 and TFS.
To use git in your visual studio environnement, you need to meet prerequisites requirement. You need to install the following tools in your windows system.
- Visual Studio 2012 with update 2
- Git for Windows
- Visual Studio Tools for Git extension
Once you have installed these tools, you need to configure GIT as visual studio source control.
Tools -> Options -> Source Control -> Microsoft Git Provider
You can create team project + git in TFS server.
Then choose Scrum as process template and Git as version control.
Open git command line on your windows system, go to your git server repository.
cd c:\GITServerRepository
update your projet from TFS server.
git clone https://xxx.com/DefaultCollection/_git/test
create project in visual studio with source control option
![](https://img-my.csdn.net/uploads/201303/12/1363081642_7292.png)
now you need to do to initialize and update your project using following commands:
->git init
->git add .
->git commit -m 'init message'
->git push origin master
![](https://img-my.csdn.net/uploads/201303/12/1363081744_2877.png)
->git pull
![](https://img-my.csdn.net/uploads/201303/12/1363081797_3331.png)
GIT common commands:
->git init: (re)init git repository for a project
->git clone server-git-directory: get a project copy from server
->git add .: add all files of current directory to new project
->git rm file-name: remove file name from project
->git help command-name: get help for specific command
->git status: get status of current branch
->git status -s: short version of status
->git branch: list all the project branches
->git branch branch-name: create a branch with name "branch-name"
->git branch -v: get last commit on each branch
->git branch -d branch-name: delete branch
->get checkout master: switch to master branch
->git checkout -b branch-name: create and switch ot branch
->git merge branch-name: merge a branch to master(trunk)
->git commit -am 'message': commit all changes with message
->git push origin master: the first init push to TFS server
->git push: push changes to TFS server
->git pull: get latest modifcations from TFS server
->git log: get log for current branch
->git tag -a v1.0: create tag named "v1.0"
->git tag -l: list all tags
->git show v1.0: show tag information
->git diff: show difference between last commits
->git diff --stat | --shortstat: display statistiques between last commits
->git diff --cached: show difference for staged modifications
Common linux commands:
->cd directory: go to directory
->touch file-name: create file
->vi file-name: edit file
->vim file-name: edit file
("i" for input text, "ESC + wq" for save input and exit the editor)
->cat file-name: read file
->rm -i file-name: remove file with confirmation
->rmdir directory-name: remove empty directory
->rm -r directory-name: remove directory and all files within
->cp -p file-name1 file-name2: copy file1 to file2 with the same user, timestamp information.
->ls -l -a -s: list all files with right(-l), with hidden files(-a), with file size(-s)
->mkdir directory-name: create empty directory
->mv old-directory-name new-directory-name: change name for directory
->clear: clear screen
Enjoy coding!
reference:
http://gitref.org
http://git-scm.com/book/en/Git-Basics-Tagging
http://www.debianhelp.co.uk/commands.htm