GIT Tips

  • Recovering lost commit
$ git reflog
  • Diff files on 2 branches
$ git difftool branch1:file1 branch2:file2
  • Picking a commit from one to another branch
$ git cherry-pick -x
  • Selectively adding changes from file
$ git add -p
  • Finding un-pushed commits on local branch
$ git cherry -v
  • Saving/recovering temporary local changes
$ git stash save
$ git stash pop
$ git stash list
  • Display current working branch in repo
$ export PS1='[u@h W$(declare -F __git_ps1 &>/dev/null && __git_ps1 " (%s)")]$ '
Advertisements
This entry was posted in Coding. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s