Skip to content

Instantly share code, notes, and snippets.

@JihoChoi
Last active July 23, 2019 08:43
Show Gist options
  • Save JihoChoi/cfcd4134dc4df3363e51ed4b96e3a35d to your computer and use it in GitHub Desktop.
Save JihoChoi/cfcd4134dc4df3363e51ed4b96e3a35d to your computer and use it in GitHub Desktop.
Git commands

Undo local changes (Discard uncommitted changes)

# https://stackoverflow.com/questions/11628074/how-to-make-git-ignore-my-changes
$ git checkout .

Undo a commit

# https://stackoverflow.com/questions/927358/how-do-i-undo-the-most-recent-commits-in-git/927386#927386
$ git commit -m "mistakes"             # (1)
$ git reset HEAD~                      # (2)

Rebase from the root

# https://stackoverflow.com/questions/8605447/how-to-rebase-all-the-commits-from-the-beginning
$ git rebase -i --root

user

$ git config --global user.email "[email protected]"
$ git config --global user.name "Your Name"

Settings

git config --global color.ui "auto" git config --global credential.helper cache

git config --global credential.helper 'cache --timeout=86400' # for a day

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