Wednesday, May 21, 2014

Git useful branching and merging commands

Create branch and switch to it
git checkout –b myNewBranch

Show all Branches
git branch

Delete a branch
Git branch –d branchName

Force delete a branch
Git branch –D branchName

Stage and commit
git commit -a

Recover a commit
git branch newBranchName “sha 1 code”

Stashing away changes
git stash

Pull changes back
git stash pop

Show stash
git stash list

Pulling in from local branch to local master
git merge branchname

Launch merge changes in mergetool
git mergetool