From the course: Learning Git and GitHub

Unlock this course with a free trial

Join today to access over 23,200 courses taught by industry experts.

Changing history

Changing history

- [Tutor] Now it's good to think of what you're doing with git as documenting the history of your project. And like I mentioned in the intro, unlike most historians you have a time machine that lets you change history. Let's take a look at some of the ways that we can do that. Now the first one is called amending. You can often end up committing something that's not quite right. You can create a new commit. But that ends up creating a messy history with a commit for a simple fix. To add things to the last commit you can use the amended flag. And when you do that, it's going to launch your default editor. And allow you to edit the file, with the amended history. Now if you don't want to do that, you can type in the minus M flag and select a new commit message. Type it in right there. Finally, you can also select the no edit function if you just want to leave the message the same as what you did in the last commit.…

Contents