Image by brgfx

Below is a table with commands I don’t run frequently enough to remember them, and have to rely on searching on internet again and again. Now it’s saved somewhere. 😀

Last update: October 3rd, 2023.

OperationCommand
Commit without filesgit commit -m "some message" --allow-empty
List commits in one line eachgit log --oneline
Remove local taggit tag -d <tag_name>
Remove remote taggit push --delete origin <tag_name>
Stash changesgit stash
Retrieve changes from stashgit stash pop
Delete local uncommitted changesgit reset --hard
Delete commits until IDgit reset --hard <commit_ID>
Delete local changes to filegit restore <file>
Revert a commitgit revert <commit_ID>
Rebasegit rebase <branch>
Rebase interactivegit rebase -i <branch>
Add a remotegit remote add <alias> <uri>

What about you? Do you want to share git commands you always forget?

Tags: git  cheat 
comments powered by Disqus