Skip to content

Instantly share code, notes, and snippets.

@jawn
Last active October 6, 2020 11:34
Show Gist options
  • Save jawn/a08cfe171b6057b9f1d06c8af1021a74 to your computer and use it in GitHub Desktop.
Save jawn/a08cfe171b6057b9f1d06c8af1021a74 to your computer and use it in GitHub Desktop.
Git commands

Rewriting the most recent commit message

On the command line, navigate to the repository that contains the commit you want to amend.

Type git commit --amend and press Enter.

In your text editor, edit the commit message, and save the commit. You can add a co-author by adding a trailer to the commit.

Source: https://help.github.com/en/github/committing-changes-to-your-project/changing-a-commit-message

Git bisect

Need to find the commit that introduced a bug?

Use git bisect.

You use it by first telling it a "bad" commit that is known to contain the bug, and a "good" commit that is known to be before the bug was introduced.

https://blog.ploeh.dk/2020/10/05/fortunately-i-dont-squash-my-commits/

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