Skip to content

Instantly share code, notes, and snippets.

@dmi3y
Last active May 21, 2021 16:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmi3y/7679280 to your computer and use it in GitHub Desktop.
Save dmi3y/7679280 to your computer and use it in GitHub Desktop.
Git Tips and Tricks

git update-index --assume-unchanged dir-im-removing/
git update-index --assume-unchanged config/database.yml
git update-index --skip-worktree

git rebase -i <earliercommit>
git commit --amend --author="Author Name <email@address.com>"

https://groups.google.com/forum/#!topic/git-users/a6zEdEQSpHw
git commit --amend -C HEAD --reset-author

git checkout --track origin/daves_branch

git push -u origin experimental

git checkout source_branch <paths>...

git branch -m
git branch -m

git remote add <alias> <remote path>
git remote -v

git remote add upstream <path>

git reset --hard HEAD~1
git reset HEAD^

HEAD^ same as HEAD~1

git remote update origin --prune

git push --delete
git push :

git cherry-pick X
git cherry-pick A..B #A should be older than B, A is excluded B is included
git cherry-pick A^..B # including A

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