Post

Git commands to remember

NOTE: Always proceed with caution.

Add code to the last commit (not adding a new commit)

1
2
git add .
git commit --amend --no-edit

Undo last commit

The --soft flag makes sure that the changes in undone revisions are preserved. After running the command, you’ll find the changes as uncommitted local modifications in your working copy.

1
git reset --soft HEAD~1

If you don’t want to keep these changes, simply use the --hard flag

1
git reset --hard HEAD~1

Add Tags

These are also known as “releases” in the GuiHub GUI

1
2
git tag -a "v0.0.1" -m "First release of this module - example"
git push --follow-tags

References

This post is licensed under CC BY 4.0 by the author.