How to Undo Git Commits, Rename a Git Branch and Checkout a Previous Commit

How to Undo Git Commits, Rename a Git Branch and Checkout a Previous Commit

Dave Gray via YouTube Direct link

git reset [commitNumber] reset code to a specific commit number and unstage the code that came after that commit

18 of 19

18 of 19

git reset [commitNumber] reset code to a specific commit number and unstage the code that came after that commit

Class Central Classrooms beta

YouTube videos curated by Class Central.

Classroom Contents

How to Undo Git Commits, Rename a Git Branch and Checkout a Previous Commit

Automatically move to the next video in the Classroom when playback concludes

  1. 1 Recap Quick Start
  2. 2 git restore [filename] undo changes
  3. 3 git restore --staged [filename] undo staged files
  4. 4 git log show log with details
  5. 5 git log --oneline shows simplified log
  6. 6 git commit -v --amend change last commit's message
  7. 7 git branch [newBranchName] creates new branch
  8. 8 git branch --list lists all branches
  9. 9 git checkout [branchName] switch to this branch
  10. 10 working with more than one branch
  11. 11 git branch -m [oldBranchName] [newBranchName] renames branch
  12. 12 git checkout -b [newBranchName] creates new branch and switches to it
  13. 13 git branch -D [branchName] deletes branch permanently
  14. 14 git merge [branchName] merges named branch into branch you are on
  15. 15 Understanding and handling git merge conflicts
  16. 16 git checkout [commitNumber] go back to a specific commit number
  17. 17 git revert [commitNumber] revert code to a specific commit number by creating new commit
  18. 18 git reset [commitNumber] reset code to a specific commit number and unstage the code that came after that commit
  19. 19 git reset [commitNumber] --hard reset code to a specific commit and permanently delete the code that came after the commit

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.