Below are the list of features that are common between TFS and GIT. However these features works a bit different due to the way they accept the code in source control and its storage.
http://vodworks.com/content.php 1) Getting sources from the source control
a) In TFS we do TF checkout to get the sources from the central server where everyone’s source code reside
b) In Git we have many options to get the sources, whose purpose varies with scenarios you are in.
you can get either from remote machine using the git pull or git fetch command or from local repository using git checkout.
There is a separate thread below to learn more on the difference between these three.
look at this site 2) To know the state of your files or rather status of your files.
a) In TFS we generally use TF stat (/format:detailed) command line to know the status in the local workspace.
b) In Git we use Git Status -v(detailed) to know the status of the files in the local repository.
3) To know the history of changes done to file, project, folder,etc..
a) TF history (/format:detailed) will give the history of the item.
b) Git log -v(detailed) will give the history of the item in question.
In order to limit the number of log entries to be displayed on the screen… you could limit it to certain numbers…
Git log -3 [To see only 3 entries]
Git log –after=”yesterday” –before=”today” [logs between yesterday and today]
Git log –after=”yyyy-dd-mm” –before=”yyyy-dd-mm” [logs between dates]
Git log –after=”yyyy-dd-mm” [log after certain date]
Git log –author=”Mayank” [by author you could get the details.]
Git log –grep=”adding” [to get logs by commit messages]
Git log – text.txt “new text document” [to get logs by file names]
Git log feature1 feature2 [to get list of commit different in feature1 and feature2 branches]
4) To ignore certiain file types and folder from check-in or commit to source control
a) .tfignore.txt can be used in TFS to ignore files and folders from check-in to source control.
b) .gitignore.txt can be used in git to ignore files and folder from check-in to source control.
5) To create a branch in the source control
a) In TFS, TF branch “branchname”
TF branches are used to list the branches
b) In Git, Git branch “branchname”
Git branch -v will list the branches
Git branch -d “Branchname” will delete the file.
Git status will give the branch you are on.
6) How the two deal with temporarily saving of the changes done to the repository or Workspace.
a) In TFS, you could create a shelveset or rather shelve your changes to get it back whenever you need it. It essentially save the bunch of changed files on to a server with a unique name to be later retrieved by that name.
tf shelve(to shelve the changes)
tf unshelve(to unshelve the changes)
b) In git, stashing is the way to temporarily save the changes done to the repository. Git stash used with to achieve that.
Git stash save “comment name”
Get stash list(will show the list)
Git stash apply “stashname” (will apply the stash)
Git stash pop (You can also run git stash pop to apply the stash and then immediately drop it from your stack.)
7) To put stuff in the source control.
a) In TFS, it is TF check-in with some sort of comment with either everything or subset of file to check-in
b) In Git, it the git commit with some sort of comment with either everything or subset of file to commit.
8) To merge branches in the source control.
a) In TFS, TF merge “branchone” “branchtwo” to merge the branches.
b) In Git, git merge or rebase is used to do the merge of branches. The essential difference between the merge and rebase is as below.
9) To rollback the changes done to the source control.
a) In TFS, TF rollback is used to do the rollback done to the source control. The rollback command will retrieve the changeset on to the local workspace and the user to has recommit or check-in to the source control to make it permanent.
b) In GIT, git revert or git reset is used to rollback the changes. Details difference between the two commands is as below.
10) To enforce certain policy before, interim and after check-in or commit to source control.
a) In TFS, you could write custom policy to enforce using check-in policy. All are implement at the server level because in TFS everything is server based or centralized.
b) In Git, you could write hooks to enforce custom commit policy.
Git hooks are nothing but policy that you would like to enforce when there is an event as below. There are two kinds of hooks, client side and server side. Below are the stages at which hooks can be applied.
The git hook reside under the .git\hooks folder
Nice article to read and understand about hooks.
11) Code Snap-Shotting in the source control.
a) In TFS, we use labels to create code snapshot.
b) In Git, we use tagging to create code snapshot.