Skip to content

Instantly share code, notes, and snippets.

@rhalff
Last active April 4, 2022 20:04
Show Gist options
  • Save rhalff/9989a706cb3b082a2bbc to your computer and use it in GitHub Desktop.
Save rhalff/9989a706cb3b082a2bbc to your computer and use it in GitHub Desktop.
git cheatsheet
git config --global alias.undo-commit 'reset --soft HEAD^'
Set your email address with the following command:
git config --global user.email "your_email@example.com"
Global gitignore:
git config --global core.excludesfile ~/.gitignore
Confirm that you have set your email address correctly with the following command.
git config --global user.email
# your_email@example.com
# Undo add of dir
git reset HEAD <file|dir>
Put your private ignore rules in .git/info/exclude. See gitignore(5).
# gnome keyring git
sudo apt-get install libgnome-keyring-dev
sudo make --directory=/usr/share/doc/git/contrib/credential/gnome-keyring
git config --global credential.helper /usr/share/doc/git/contrib/credential/gnome-keyring/git-credential-gnome-keyring
# Branch with No Ancestors
You want the --orphan flag. For example:
git checkout master
git checkout --orphan foo
# Unstage all the files in your working tree.
git rm --cached $(git ls-files)
# Use git-dude for notificiations
https://github.com/sickill/git-dude
# checkout remote branch
git checkout -b <branch> origin/<branch>
# create `git reset-permissions` command
git config --global --add alias.permission-reset '!git diff -p -R | grep -E "^(diff|(old|new) mode)" | git apply'
# apt-get install git-extras
git-release version.number
# merge project
$ git checkout master
$ git fetch babel-starter-kit
$ git merge babel-starter-kit/master
$ npm install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment