Skip to content

Instantly share code, notes, and snippets.

@dmi3y
Last active May 21, 2021 16:49
Show Gist options
  • Select an option

  • Save dmi3y/7679280 to your computer and use it in GitHub Desktop.

Select an option

Save dmi3y/7679280 to your computer and use it in GitHub Desktop.
Git Tips and Tricks

#Ignore tracked files

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

#Change previous commit author git rebase -i <earliercommit>
git commit --amend --author="Author Name <[email protected]>"

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

#Push local branch to remote repo

git push origin experimental

#Copy-paste from one branch to another

git checkout source_branch <paths>...

#Add remote repo

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

#Remove commit

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

HEAD^ same as HEAD~1

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