Git Tutorial: Fixing Common Mistakes and Undoing Bad Commits

preview_player
Показать описание
In this video we will look at some common mistakes in Git and how we can fix these mistakes. Specifically we will cover how to discard changes since your last commit, amending commits, cherry-picking hashes, resetting to a specific commit, and reverting to a specific commit.

✅ Support My Channel Through Patreon:

✅ Become a Channel Member:

✅ One-Time Contribution Through PayPal:

✅ Cryptocurrency Donations:
Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot

✅ Corey's Public Amazon Wishlist

✅ Equipment I Use and Books I Recommend:

▶️ You Can Find Me On:

#Git
Рекомендации по теме
Комментарии
Автор

I made a slight mistake in the video. The -f option on git clean is for "force" and not for "files". The documentation can be found here for more info:

coreyms
Автор

1:42 - Revert back the code that was written
3:36 - Updating the commit message alone (amend)
5:50 - Accidentally left off a file that we wanted to commit
7:38 - Move the commits to a different branch (cherry-pick)
10:26 - 3 different types of reset
13:38 - Getting rid of untracked files (git clean)
15:01 - Retrieve critical files that were lost, and you want them back (git reflog)
18:10 - Backing out changes, when other people have already checked out your changes (git revert)

ajeethv
Автор

Am DevOps. Best tutorial for python and git so far. Even paid tutorials are not able to reach this level of profession . Keep it up :)

janarthananv
Автор

One of the best git (or any other) tech videos i've seen in a long long time! Great job!!

avishal
Автор

I am git newbie. This video saved my files that I thought I lost in a series of unintended commits. About 2 weeks worth of work! Thanks so much Corey and keep up the good work.

pooyarowgh
Автор

I can see simplicity and at the same time your professional way of explaining it. Thank you for investing your time to save our's

studyonline
Автор

This is the second video I've watch by Corey. I've been in software development for over 20 years and he explains Git better than anybody I've come across. Keep up the great work you're doing. :)

carlellis
Автор

Brilliant structure and sequencing and crystal clear examples. A lot of key functionality covered effectively and concisely.

timfitzgerald
Автор

After deciding to ditch the Git GUI in favor of command-line, I came across your videos. You have done a fantastic job compiling the essentials and demoing them! It feels like I finally understand what ACTUALLY is going on when I use these commands. Thank you!!

BanglawalaNeesarg
Автор

The most awesome tutorial about git reset/checkout/revert commands, I ever seen so far. Great! Thankyou!

archtaurus
Автор

Very very helpful tutorial for some of the more advance/obscure features related to rollback and reset. While this tutorial is long and someone in need of quick answer may run out of patience, I still recommend a good listen. Its better to know details rather than following commands without knowing basics. Thanks Corey for quality tutorial.

deoray
Автор

Wow. Watched all the videos on GIT. The flow and structure of the lecture(s) in all the videos is so smooth, that I Never had to rewind and ponder .." what did he say"... . More than perfect !

sriramab
Автор

This is the best video tutorial for Git. Neat, straight to the point, stunningly clear. High quality teaching.

MauricioSalazare
Автор

After watching this video, I wish I could give it a thumbs-up 51 times so you hit 1000. Deserves it!

ashishm
Автор

Perfect video, thanks! Keep it going, guys like you make this world a better place.
1 advice though: use head/head~/head~n/head^ syntax instead of sha-1 codes so that you can focus more on the intention and less on the implementation details of git.

For example:
10:40 - instead of using git log to find sha-1 codes, just use git reset --soft head~
(I want to reset to the second to latest commit)
20:00 - instead of using git log to find sha-1 codes, just use git diff head~ head
(i.e. I want a diff between second to latest commit and latest commit on the branch I'm on)

additional tips:
- checkout head^ which differs from head~ only when you have merge commits. (you can also use head^n)
- use head~n to go back n commits into the past.
- head is a synonym for the sha-1 of the latest commit.

aleksagordic
Автор

The BEST video on advanced git out there. I'm amazed by the use cases Corey has shown. I can't thank you enough for the efforts you put. I'll definitely do my part to support your channel.

jadia
Автор

Despite the quick 'clears', which throw off and freak out beginners, this is the clearest explanation of fixing mistakes and changing history. Thanks.

PaulMcCannWebBuilder
Автор

Best git tutorial ever made on planet earth.

JamesLee-tgxl
Автор

You are awesome. your teaching skills are extraordinary In 21 minutes you just cleared everything that I need to understand to get rid of all those confusions that often happened to me.
Thank you so much <3

ubaidraza
Автор

One of the most helpful video on git that I came across, great job :)

harshwardhanrathore