From the course: Complete Guide to Git
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Amend commits - Git Tutorial
From the course: Complete Guide to Git
Amend commits
- [Instructor] In this movie, we will learn how to amend commits that are in the repository. Git only allows us to amend the most recent commit in each branch. The amend feature is designed to help you to make quick adjustments to a commit that you just made. A common example is to make a commit and then notice a mistake in Git status or log soon afterwards. You can edit the changes that are stored in the commit and you can edit the commit message. Again, this is only the most recent commit. The other commits before it can only be changed if we use more advanced techniques like rebate and reset, which we'll learn later in this course. The reason it's easier to edit the most recent commit than those older ones goes back to what we learned about how Git generates SHAs. Any change to a commit will cause the SHA that's used to identify that commit to change too. Commits are linked together in a chain and every commit includes a reference to its prior or parent commit. This feature…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.