Skip to content

Instantly share code, notes, and snippets.

@alameenkhader
Last active September 18, 2015 06:11
Show Gist options
  • Save alameenkhader/e1407620c0fc8980da63 to your computer and use it in GitHub Desktop.
Save alameenkhader/e1407620c0fc8980da63 to your computer and use it in GitHub Desktop.

Undo a local merge (not comited/pushed yet)
git reset --hard <last-commit-id>
Above command will move to the state of the last commit, ignoring all the changes.

If you want to push after a hard reset, use -f option
git push origin <branch-name> -f

To checkout by folder
git checkout master -- db/migrate

To view all branches in local
git branch -a

To view all the branches in origin(remote)
git remote show origin

Stashing http://git-scm.com/book/en/Git-Tools-Stashing
To push a new stash onto your stack
git stash
To see which stashes you’ve stored
git stash list
To apply stash
git stash apply

To remove a branch
From local
git branch -D <branchName>
From remote
git push origin --delete <branchName>

http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging

gitignore To remove added file from not to index git update-index --assume-unchanged db/schema.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment