Skip to content

Instantly share code, notes, and snippets.

@anacunha
Last active November 17, 2022 00:55
Show Gist options
  • Save anacunha/aaad787f324b3336adba047916ff32b4 to your computer and use it in GitHub Desktop.
Save anacunha/aaad787f324b3336adba047916ff32b4 to your computer and use it in GitHub Desktop.
Git

Git

Setting Git Username and Email for a Single Repository

git config user.name "Your Name"
git config user.email "name@email.com"

Amend Author

git commit --amend --reset-author

Set Vim as default editor

git config --global core.editor "vim"

Rebase Interactive

git rebase -i HEAD~5

git rebase -i --root

Revert Commit

git revert HEAD

git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git

git fetch upstream
git checkout master
git merge upstream/master

File Full History

git log --full-history -- [file path]

Multiple git accounts

ssh-keygen -t rsa -C "mcunha.ana@gmail.com"

Make a file executable

git config core.fileMode false
git update-index --chmod=+x ./.github/scripts/script.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment