Showing posts with label Git. Show all posts
Showing posts with label Git. Show all posts

Friday, June 1, 2012

Some useful commands in Git

1) If You are interested in merging in the branch and want to see what commits are going to effect when we do that merge.

You can do this by putting a ^ in front of the branch that you don't want to see. 

$ git log --oneline branchname ^master

or

$ git log --oneline master ^branchname

2) To show stats for each commit
 
$ git log --stat

It lists which files were modified, how many lines added or deleted  

Wednesday, March 21, 2012

Revert in Git

1) If you have already committed your changes and want to “undo” the changes

git revert  $id

where $id is the commit id

This will create a second commit which undoes the changes of the given commit.

2)  Revert the last commit

git revert HEAD

3) Return to the last commited state

git reset --hard

Thursday, March 8, 2012

Git Cheat Sheet


Optimize performance on Git

Below Git is a distributed version control system, and is used to manage files. 
Below commands are very useful to optimize the performance on Git.
  • git status - This scans your working copy and git objects and gets some of that into the disk cache.It speeds up subsequent git operations.   
  • git gc - To garbage collect and compress your git repository. Git  perform this operation on its own when needed.