Skip to content
Greg Swindle edited this page Apr 25, 2018 · 1 revision

How to modify a specified commit in git?

You can use git rebase, for example, if you want to modify back to commit bbc643cd, run

$ git rebase --interactive 'bbc643cd^'

In the default editor, modify pick to edit in the line whose commit you want to modify. Make your changes and then commit them with the same message you had before:

$ git commit --all --amend --no-edit

to modify the commit, and after that

$ git rebase --continue

to return back to the previous head commit.

WARNING: Note that this will change the SHA-1 of that commit as well as all children -- in other words, this rewrites the history from that point forward. You can break repos doing this if you push using the command git push --force

"git rewrite history - How to modify a specified commit in git? - Stack Overflow." $site. April 13, 2018. $publisher, Web. April 13, 2018. https://stackoverflow.com/questions/1186535/how-to-modify-a-specified-commit-in-git?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

Git Git logo

Terminal CLI snippets for git.

  1. Git tips
  2. Git notes

tasklist This checklist—adapted from bahmutov/npm-module-checklist link-external—provides useful tips to ensure your module is ready for production deployment and publication.

verified Openly declare the health of your product, project, community, and source code with these essential badges. (GitHub SaaS only.)

UX Cheat-sheets

Info Icons, images, gists, code snippets, etc.

  1. Architecture Decision Record status labels
  2. Octicon cheatsheet
  3. Project status badges
  4. TechRadar labels

Telescope Stellar languages, frameworks, platform, techniques, and tools.

Clone this wiki locally