Skip to content

Instantly share code, notes, and snippets.

@mahendra0859
Last active October 30, 2020 08:13
Show Gist options
  • Save mahendra0859/54fec47d991273d64a410cd6d06d3184 to your computer and use it in GitHub Desktop.
Save mahendra0859/54fec47d991273d64a410cd6d06d3184 to your computer and use it in GitHub Desktop.
Git version controll commands

clone a specific Git branch

Use multiple ssh-keys for different GitHub accounts on the same computer

How to change the author of all your commits

$ git filter-branch -f --env-filter "GIT_AUTHOR_NAME='yourname'; GIT_AUTHOR_EMAIL='youremail@example.com'; GIT_COMMITTER_NAME='yourname'; GIT_COMMITTER_EMAIL='youremail@example.com';" HEAD;
$ git commit --amend --author="John Doe <john@doe.org>";
$ git commit --amend --author="Author Name <email@address.com>" --no-edit

How can I edit / fix the last commit's message?

Amending the Last Commit To change the last commit, you can simply commit again, using the --amend flag

$ git commit --amend -m "Title" -m "Description
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment