Last active
April 4, 2022 20:04
-
-
Save rhalff/9989a706cb3b082a2bbc to your computer and use it in GitHub Desktop.
git cheatsheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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