Learn how to rewrite Git history - Amend, Reword, Delete, Reorder, Squash and Split

  Рет қаралды 157,462

The Modern Coder

The Modern Coder

Күн бұрын

Пікірлер: 269
@themoderncoder
@themoderncoder Жыл бұрын
I HAVE MORE GIT VIDEOS! kzbin.info/aero/PLfU9XN7w4tFwKwh_xPSQ_X1-hROQEpHnM. Additionally, a written reference for this video is available on my blog: www.themoderncoder.com/git/
@tomng92
@tomng92 4 жыл бұрын
Pure gold! Learnt faster in those 12 mins than reading any book.
@Trhnetesiuz
@Trhnetesiuz 3 жыл бұрын
3 hours of other videos in 13 minutes. Awesome. Thanks a lot
@1murkeybadmayn
@1murkeybadmayn 2 ай бұрын
Your style of teaching is one I've always wished for - the instructions but alongside an actual visualisation of what is happening in the end goal. I've been struggling to understand my teacher but thank you for this video and others.
@RedFenceAnime
@RedFenceAnime 3 жыл бұрын
put the timestamps before the topic in the description and KZbin will automatically add chapters to the progress bar 0:00 - intro 0:40 - Amending commits 2:04 - Rewording commits 4:14 - Deleting commits 5:34 - Reordering commits 7:04 - Squashing commits 9:09 - Splitting commits The "0:00" is needed
@ozen8499
@ozen8499 2 жыл бұрын
thx
@themoderncoder
@themoderncoder 2 жыл бұрын
Good tip thanks. I went ahead and made those changes
@gaofan2856
@gaofan2856 Жыл бұрын
Perfect video, short, precise with visualization. Not like telling the history of git for 40 minutes, and then start explaining things like others do
@abdul-aleemelmuzoghi4133
@abdul-aleemelmuzoghi4133 3 жыл бұрын
Been 2 days trying to learn how to delete a commit and you just came and and did it in 2 minutes
@slavoie
@slavoie 4 жыл бұрын
Thanks for this! If you stick to Vim as the default Git text editor, you may want to know about the following commands as a starting point: gg → Go to top of buffer/file. ddp → Delete a line and put it below the current one (to re-order commit). `dd` deletes a line while `p` put it below the current line. ddkP → Delete a line and put it above the current one. `dd` deletes a line, `k` moves up one line and `P` (uppercase) pastes above the current line. h / j / k / l → Move around à la Vim. x → Delete a character xp → Switch the order of two characters. G → Go to the end of the buffer/file. ZZ → Save and quit buffer. For this purpose, same as `:wq` but less keystrokes ;). There's obviously much more to learn, but that should be useful to at least do some basic operations. Also, when splitting a commit, a single file might be part of two commits. So to commit only part of a file, there's also an interactive staging mode: git-scm.com/book/en/v2/Git-Tools-Interactive-Staging
@SomeYouTubeGuy
@SomeYouTubeGuy 4 жыл бұрын
Great comment but I'm surprised you didn't include 'dw'. No one should be backspacing a word in Vim
@joshuakoehler6457
@joshuakoehler6457 4 жыл бұрын
@@SomeKZbinGuy I thought a similar thing, but would recommend 'cw' (change word) instead, which enters you into insert mode after deleting the word. So it is equivalent to 'dw' + 'i'
@SomeYouTubeGuy
@SomeYouTubeGuy 4 жыл бұрын
@@joshuakoehler6457 It would seem you know a tiny bit more Vim than I.
@vaibhavgarg5607
@vaibhavgarg5607 8 ай бұрын
Was stuck on a PR as I was unable to edit a commit's changes this video saved me. Really helpful
@losrobbosful
@losrobbosful 5 жыл бұрын
This was gold, helped me a lot. Definitely great teaching abilities.
@arthurh2064
@arthurh2064 4 жыл бұрын
I wish you wouldn't have stopped uploading git tutorials, they are by far the best I've seen and I've seen many
@peterdoyle1994
@peterdoyle1994 3 жыл бұрын
Best, clearest git tutorials by a country mile. Thanks.
@moe-eh5vi
@moe-eh5vi 2 жыл бұрын
I like that this video is recorded in a kitchen. Makes it feel less intimidating. Also very clear explanations.
@vishnuthamizharasan6192
@vishnuthamizharasan6192 4 жыл бұрын
I have searched for answers and videos I didn't get anywhere, but the way you explain git is amazing and one of the best explanations ever seen. You are soo good at Git man. Thanks for the Video. Please make more videos. I love it
@krazee_aznnn
@krazee_aznnn 4 жыл бұрын
I mean, so many comments before have said this, but I need to confirm: this tutorial was more clear and understandable than the articles and other videos I watched about rebasing and changing Git commit history! I get it now!
@thesavagesalmon9464
@thesavagesalmon9464 5 жыл бұрын
This channel is COMPLETELY underrated. You deserve a tonne more subscribers. Keep consistently making quality videos such as this, and you will make it bigger in no time!
@kapaaaau
@kapaaaau 4 жыл бұрын
This is the best explanation I have seen for Git's commands, and they are real world solutions for real world problems. Thank you very much.
@m4rt_
@m4rt_ Жыл бұрын
Holy shit, git rebase is powerful. I will keep this in mind whenever I want to fix something in my git history.
@daggerok
@daggerok 4 жыл бұрын
1) in vim instead of :wq you can use :x its shorter 2) when explaining drop, you should mention, that changes in README file also will be reverted, not only commit message from git history, so people who wants only remove commit message, but not changes should use fixup 3) in vim, instead of cut-paste, use copy (press yy on line to copy in command mode) + paste (press p on line above place where you want paste) + delete (press: dd on line to delete)
@mariano.zunino
@mariano.zunino 4 жыл бұрын
3) dd and P was all he need. No yank was needed in this video.
@Andriak2
@Andriak2 4 жыл бұрын
To clarify in 3) dd is like cut, yy is like copy, p is like paste (but using registers instead of clipboard)
@d-e-v-esh
@d-e-v-esh 3 жыл бұрын
This is the best video by far I have seen on KZbin. Thank you so much man....
@alpavaidya412
@alpavaidya412 4 жыл бұрын
The animation is what is required to understand Git commands...thanks for making the effort to make them to explain....please make more videos on Git
@gabrielsoloman5000
@gabrielsoloman5000 4 жыл бұрын
best series on non-basic git, congrats
@BatsAwesomeIn2030
@BatsAwesomeIn2030 3 жыл бұрын
Really like the video, and the written blog is good too. Clear, concise and to the point.
@zmark2274
@zmark2274 3 жыл бұрын
Over and over hank you again to express yourself in so clear way
@pascualrosario8633
@pascualrosario8633 Жыл бұрын
You have a gift for teaching. Very concise and easy to understand.
@fullstackprojects5615
@fullstackprojects5615 3 жыл бұрын
git rebase is a very powerful tool. Thanks for sharing your knowledge :)
@zmark2274
@zmark2274 3 жыл бұрын
Can't express how thankful I am to you. So accurate and informative. Thank you indeed
@codewithsub5083
@codewithsub5083 4 жыл бұрын
This is the best tutorial of git I have ever seen. Thanks man
@cddrury
@cddrury 4 жыл бұрын
Great explanation and the graphical representation you used while typing the commands made it much easier to understand from a visual perspective. Keep up the good work!
@VKD007
@VKD007 2 жыл бұрын
i fixed something today by manual merging with dev branch if i knew this before i wouldnt need to do manual work. Thanks man nice videos
@nospecialmeaning2
@nospecialmeaning2 3 жыл бұрын
Subscribed! You might be the only KZbinr I have an occasional compulsion to listen to at lower than normal speed :D
@786saga
@786saga 4 жыл бұрын
Dude it really helped me a lot i was missing the few of these concepts of git thank you.
@rabishankar5993
@rabishankar5993 3 жыл бұрын
Hidden gems of youtube.
@najimali32
@najimali32 2 жыл бұрын
Your Git Videos are really helping me to play with my commits & branch at work. Thank you so much.
@darkphoenix68
@darkphoenix68 5 ай бұрын
I came to Git from SVN -- and the ability to modify history was probably the hardest thing to wrap my head around. Not only that it was possible, but that there were situations where it is actually desirable! Now ... well, I could not go back to SVN! 🙂
@alexanderjesusvargas5998
@alexanderjesusvargas5998 4 жыл бұрын
It is crazy this is free content!
@nikolajovanovic1140
@nikolajovanovic1140 4 жыл бұрын
Concise and straight to the point. Bravo!
@Mark986270
@Mark986270 Жыл бұрын
Thank you very much. This was just what I needed to clean up my merge requests
@sumanghosh4439
@sumanghosh4439 2 жыл бұрын
Excellent! Thank you so much for this video. I have struggled with rebasing and was scared. But your teaching skill is excellent and I learnt in few minutes and used it successfully.
@MartijnMuijsers
@MartijnMuijsers 2 жыл бұрын
Great concise explanation of everything that might matter to someone!
@sebastianfarias5670
@sebastianfarias5670 4 жыл бұрын
Simply the best GIT explanation ever, super concise and really helped me get out of a pickle today !!! THANK YOU !
@cristhiancantillo4922
@cristhiancantillo4922 22 күн бұрын
The best channel for learning git = )
@die1234abc
@die1234abc 4 жыл бұрын
Best explanatory video on all this subjects! Thanks and keep up the good work!
@mr.w7803
@mr.w7803 4 жыл бұрын
All things I've done before, but I do them so infrequently I forget the work flow... thank you so much for the walk through!
5 жыл бұрын
Omg did not know that is possible to reording commits. So darn simple! Thank you!
@alanjrobertson
@alanjrobertson 2 жыл бұрын
Another excellent video, wish you'd come back to KZbin and do more!
@ianedits1
@ianedits1 2 жыл бұрын
Short and precise. Good job sir
@videet
@videet Жыл бұрын
Clear and crisp. Thank you.
@AIGenerated
@AIGenerated 4 жыл бұрын
Good job this video looks edited by a professional company, the animations really help, keep up the good work
@abhinavjain8962
@abhinavjain8962 4 жыл бұрын
Can we all take some time and address that this is the best Git tutorial video... On the internet.... And how many dumb asses this guy has saved including mine.. .... 😊. # Awesome explanation guru ..!!
@themoderncoder
@themoderncoder 4 жыл бұрын
Nice dude
@JoshuaMusau
@JoshuaMusau 4 жыл бұрын
You make a really good teacher...
@NirdeshM
@NirdeshM 4 жыл бұрын
Very informative with awesome explanation.
@shivanjalikaname8935
@shivanjalikaname8935 4 жыл бұрын
Voila...you gained a subscriber.. just loved the way you explain technically and practically
@danielwestberg9540
@danielwestberg9540 4 жыл бұрын
Very well explained! Super good with the visual branches to better understand what's happening
@greenmanreddog
@greenmanreddog 4 жыл бұрын
Very clear and concise explanations - thanks.
@forkanali
@forkanali 4 жыл бұрын
very helpful and short video. short time you teach me alot. thank you !
@iconjack
@iconjack 4 жыл бұрын
This was an amazing video. I learned a lot, including: I will never split a commit.
@SarnenduMukherjee
@SarnenduMukherjee 3 жыл бұрын
Thank you for this superb video. Awesome animation and edit makes this video more awesome.
@gabrielsanmartin8326
@gabrielsanmartin8326 3 жыл бұрын
Awesome buddy! I'm trying to go deep into git.. and this video was gold.
@youssefsabbagh4341
@youssefsabbagh4341 2 жыл бұрын
Great video !! Couldn't have explained it any better !!
@przemekostrowski3108
@przemekostrowski3108 Жыл бұрын
Very good video. Well explained. Thank you!
@nrmlkmrks
@nrmlkmrks 4 жыл бұрын
Awesome video! Great example of explaining stuff to the point with really good examples.
@backpropagation8365
@backpropagation8365 4 жыл бұрын
I think we can also go directly to the commit by git checkout . This will give us a detached HEAD. Then you do all you need - unstage, add, and recommit etc. Then attach the HEAD to a temporary branch and merge/rebase it with some exisiting branch. But I guess the interactive rebase is much easier? By the way video is great. Thanks.
@GuillermoAguilarCruz
@GuillermoAguilarCruz 4 жыл бұрын
Thanks, you really know how to explain in a faster and cooler way. Just one question, how can I perform these operations if I have previously pushed my changes?
@mohammadanas3320
@mohammadanas3320 3 жыл бұрын
You r underrated bro...keep making videos
@pradeepnooney3056
@pradeepnooney3056 3 жыл бұрын
Thank you so much. Very good tutorial. and good animation too
@SakhawatHossainlive
@SakhawatHossainlive 3 жыл бұрын
Wonderful !! Thanks for this video man.
@theoceandragongaming
@theoceandragongaming 10 ай бұрын
This man sitting in his kitchen saving life of thousand of engineers. Kudos
@themoderncoder
@themoderncoder 10 ай бұрын
Love it. Those were the days
@rohitkumarshrivastava9693
@rohitkumarshrivastava9693 3 жыл бұрын
You are a genius!! This video has helped me a lot
@demian256able
@demian256able 3 жыл бұрын
excelent vídeo. very clear explained. that kind of graphics are a very good idea.
@predatorjoutube
@predatorjoutube 5 жыл бұрын
Thank you! I like when you show the graphic, because it explains exactly what is git doing under the hood. It would be greate if you could explain how does command "pick" work combined for instance with a remote master? What is the efficient way to pick a commit between many commits, add changes and push it to origin master. How can we manipulate the history of commits, which were already pushed to origin master? Thank you for your response.
@themoderncoder
@themoderncoder 5 жыл бұрын
Any sort of rewriting of commits that have already been pushed to remote master is not recommended. That's why you saw me in the video working mostly with commits on a local feature branch, because it's dangerous to rewrite history that is shared upstream to other collaborators. If you absolutely need to rewrite commits that have been pushed to remote branches, you can use "git push --force" but you'd need to have every other collaborator do a hard reset of their local repos. If you do this just note that every action that I went over in the video is destructive (even rewriting the commit message wipes away and rebuilds the original commit) so rewrite remote history at your own risk
@latest_disaster_videos_globe
@latest_disaster_videos_globe 2 жыл бұрын
@@themoderncoder hi buddy how are you? I can not see any new content on this channel since 2 years. I hope you are well.
@rahuldasmajumder7690
@rahuldasmajumder7690 2 жыл бұрын
Thanks man..it really cleared the doubts✌️
@louaiforui
@louaiforui 2 жыл бұрын
Great job! great explanation!
@Pumazr
@Pumazr 4 жыл бұрын
Great video, so clean explanation.
@Anujgupta-yi9di
@Anujgupta-yi9di 3 жыл бұрын
Great job! Explains everything so easily :)
@donalexey
@donalexey 5 жыл бұрын
This is just a great tutorial!
@soumyadrip
@soumyadrip 4 жыл бұрын
Great video,solved so many doubts
@shaka1240
@shaka1240 4 жыл бұрын
Thanks a lot, this tutorial helped me a lot to fixing my shitty commits,
@Kamaltweet
@Kamaltweet 4 жыл бұрын
Wow. You made it so easy to learn. Thank you 🙏
@bseroy
@bseroy 4 жыл бұрын
These videos are fantastic!
@siegblink182
@siegblink182 4 жыл бұрын
Thanks for making this video. This has solved most of my problems.
@martinspilovsky9071
@martinspilovsky9071 3 жыл бұрын
Thank you so much for this compilation
@qCJLbggG4IWAY9nTH6o
@qCJLbggG4IWAY9nTH6o 2 жыл бұрын
I'm thankful for your content
@magakz
@magakz 2 жыл бұрын
Awesomeee!!! Thanks man! Cool video, helped me a lot!
@akbarhafeezbutt1761
@akbarhafeezbutt1761 2 жыл бұрын
Thank you very much for your knowledge sharing, you're the best!
@disgeneric4346
@disgeneric4346 3 жыл бұрын
Hey, thanks a lot for this tutorial! I've looked through several text ones, but they were not as clear as yours!
@AdamTheBen
@AdamTheBen 4 жыл бұрын
Thank you very much for your content. Extremely helpful. Love the animations, they make it so easy to wrap your head around the concepts.
@rubenrdias
@rubenrdias 5 жыл бұрын
Great tutorial! Very useful and nicely explained.
@10SURA
@10SURA 3 жыл бұрын
Thank you very much for your content. Extremely helpful
@ratenoopee
@ratenoopee 4 жыл бұрын
Clearly and easy to understand. thank for good video. :-)
@liminal27
@liminal27 3 жыл бұрын
Excellent tutorial.
@samithakulatilaka
@samithakulatilaka 4 жыл бұрын
Great Explanation. Thank You.
@violindiep
@violindiep 4 жыл бұрын
Very clear explanation, thanks !
@ashleyrawr74
@ashleyrawr74 4 жыл бұрын
This is such a helpful resource! :)
@vidyawimalasooriya6604
@vidyawimalasooriya6604 3 жыл бұрын
Superb Explanation
@rockydev5750
@rockydev5750 5 жыл бұрын
Amazing Dude! Thanks for your video.
@BG-fo4si
@BG-fo4si Жыл бұрын
You explained it beautifully
@mrrajib
@mrrajib 4 жыл бұрын
Awesome tutorial. Learnt new things. Cheers (y)
@dhansb883
@dhansb883 Жыл бұрын
this is what ive been looking for
@DavidLance
@DavidLance 4 жыл бұрын
Absolute life saver! Thanks a ton for this.
Learn Git Squash in 3 minutes // explained with live animations!
3:56
The Modern Coder
Рет қаралды 310 М.
Git MERGE vs REBASE: The Definitive Guide
9:39
The Modern Coder
Рет қаралды 128 М.
How many people are in the changing room? #devil #lilith #funny #shorts
00:39
Long Nails 💅🏻 #shorts
00:50
Mr DegrEE
Рет қаралды 17 МЛН
Git Tutorial: Fixing Common Mistakes and Undoing Bad Commits
21:31
Corey Schafer
Рет қаралды 384 М.
The Value of Source Code
17:46
Philomatics
Рет қаралды 204 М.
Vim Tips I Wish I Knew Earlier
23:00
Sebastian Daschner
Рет қаралды 79 М.
DHH discusses SQLite (and Stoicism)
54:00
Aaron Francis
Рет қаралды 100 М.
So You Think You Know Git - FOSDEM 2024
47:00
GitButler
Рет қаралды 1,2 МЛН
How to be a git expert
46:26
Floating Little Leaves of Code
Рет қаралды 172 М.
How to Do 90% of What Plugins Do (With Just Vim)
1:14:03
thoughtbot
Рет қаралды 907 М.
How GIT works under the HOOD?
16:01
Tech With Nikola
Рет қаралды 206 М.
Git best practice tip: clean commit history
51:30
academeez
Рет қаралды 1,1 М.
How many people are in the changing room? #devil #lilith #funny #shorts
00:39