Git Tutorial 5: Undoing/Reverting/Resetting code changes

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 ต.ค. 2024

ความคิดเห็น • 168

  • @codebasics
    @codebasics  2 ปีที่แล้ว

    Do you want to learn technology from me? Check codebasics.io/ for my affordable video courses.

  • @mubarakl7676
    @mubarakl7676 7 ปีที่แล้ว +16

    Really love your class. I was very much confused while learning Git, but you made it very easy. Keep doing this great work

    • @ADAMSIVES
      @ADAMSIVES 7 ปีที่แล้ว

      mubarak l me too!

  • @YuriiHonta
    @YuriiHonta 2 ปีที่แล้ว

    So simple, so understandable and with the Indian accent that switches the brains into learning mode. Thank you!

  • @skkkks2321
    @skkkks2321 5 ปีที่แล้ว +2

    A very technical term committed in very simple words...great job.

  • @architapatnaik687
    @architapatnaik687 ปีที่แล้ว

    This tutorial is so helpful. Thank you for explaining it, so beautifully . Very straightforward and on point.

  • @islam_basicknowledge
    @islam_basicknowledge 2 ปีที่แล้ว

    Dear Dhaval, Thank you very much for all your efforts and time.

    • @codebasics
      @codebasics  2 ปีที่แล้ว

      You are most welcome

  • @arisis6709
    @arisis6709 5 ปีที่แล้ว +31

    I like the way you explain, but the background music is distracting :(

    • @HuyLe-sb7cw
      @HuyLe-sb7cw 5 ปีที่แล้ว +2

      IKR, I couldn't concentrate at all

  • @code3design
    @code3design 4 ปีที่แล้ว +1

    One of the best Git tutorials. It was easy to follow and straightforward which for some reason most Git tutorials lack. After I did a $git reset --hard and then tried to push I got this message: hint: Updates were rejected because the tip of your current branch is behind. Is there like a force push?

    • @codebasics
      @codebasics  4 ปีที่แล้ว +2

      You can use git push --force

    • @code3design
      @code3design 4 ปีที่แล้ว +1

      @@codebasics That worked! Thank you!!

  • @vinodpasi8021
    @vinodpasi8021 5 ปีที่แล้ว

    Its easy to learn git by watching your videos

  • @carolinebuttet7095
    @carolinebuttet7095 4 ปีที่แล้ว +6

    Exactly what I was looking for, thanks!

  • @vanthuanluong9398
    @vanthuanluong9398 4 ปีที่แล้ว

    Indian guys on youtube are always life savors

    • @codebasics
      @codebasics  4 ปีที่แล้ว +1

      Thanks Van for lovely comment.

  • @norulshahlamjohn1140
    @norulshahlamjohn1140 3 ปีที่แล้ว

    u saved my files.. thank you mr good indian teacher

  • @codebasics
    @codebasics  4 ปีที่แล้ว +2

    Step by step guide on how to learn data science for free: th-cam.com/video/Vn_mmOuQkSA/w-d-xo.html
    Full python course: th-cam.com/play/PLeo1K3hjS3usILfyvQlvUBokXkHPSve6S.html
    Machine learning tutorials with exercises:
    th-cam.com/video/gmvvaobm7eQ/w-d-xo.html

    • @jadbrayden5154
      @jadbrayden5154 3 ปีที่แล้ว

      i realize I'm kinda off topic but does anybody know of a good site to stream new movies online ?

    • @AmeerAli-od6xe
      @AmeerAli-od6xe 3 ปีที่แล้ว

      @Jad Brayden Flixportal xD

    • @jadbrayden5154
      @jadbrayden5154 3 ปีที่แล้ว

      @Ameer Ali Thanks, I signed up and it seems like they got a lot of movies there :D I really appreciate it !

    • @AmeerAli-od6xe
      @AmeerAli-od6xe 3 ปีที่แล้ว

      @Jad Brayden No problem :D

    • @sureshmakwana8709
      @sureshmakwana8709 2 ปีที่แล้ว

      git revert -n is giving output of command not found
      PS: I copy pasted correct commit ID

  • @zohaibramzan6381
    @zohaibramzan6381 3 ปีที่แล้ว

    I love to watch ur videos. Kindly create CI/CD video and also on docker series.

  • @TrollAxeThrower
    @TrollAxeThrower 6 ปีที่แล้ว +8

    Nice 80's erotic films music. And thanks for the video. :)

  • @urigross
    @urigross 2 ปีที่แล้ว

    Yes you saved me ! I didn't know how to revert changes now I easly know how to! thanks :)

  • @abhishekkumarsingh3678
    @abhishekkumarsingh3678 2 ปีที่แล้ว

    I have not made any changes(just cloned) and can see 61 in git changes , added giignore file also , any idea why? and solution?

  • @pawandeore6989
    @pawandeore6989 4 ปีที่แล้ว

    This helped me lot thanks
    For the moment I was like God now I am dead then I did git reset --hard HASH. Saved me 😁

  • @rickdee888
    @rickdee888 3 ปีที่แล้ว

    Hi. Do you have any video that show git reset -soft - mixed and maybe how to recover from reset?

  • @ravikumar17_18
    @ravikumar17_18 3 ปีที่แล้ว

    Can I use git revert change-id to undo the local committed changes that hasn't been pushed to remote repo?and is this this command reverts particular change or affects other, Please help me

  • @HemachandhiranHarimoorhty
    @HemachandhiranHarimoorhty 4 ปีที่แล้ว

    Its very helpfull. Thank you for such a clear explanation about git options.

    • @codebasics
      @codebasics  4 ปีที่แล้ว

      Glad it was helpful!

  • @radaboy5755
    @radaboy5755 2 ปีที่แล้ว

    at 4:50 the untracked(unstaged ./idea) file will not get commited. only files in staging area get to commit.
    git commit -am " some message" will not add files to tracking and won't commited.

  • @islam_basicknowledge
    @islam_basicknowledge 2 ปีที่แล้ว

    Do I have to save my file, before doing git add and commit?

  • @LCCVR1975
    @LCCVR1975 4 ปีที่แล้ว

    Very well organized tutorial.

    • @codebasics
      @codebasics  4 ปีที่แล้ว

      Luiz, thank you so much for the feedback.

  • @liamconverse8950
    @liamconverse8950 2 ปีที่แล้ว

    Them some jammin tunes my dude

  • @kostasnikoloutsos5172
    @kostasnikoloutsos5172 7 ปีที่แล้ว

    I am wondering if it should be worth learning all these parameters for push,commit,add,revert,reset etc
    Anyway, I am excited about programming world.It would be helpful if you suggest any good free pdfs to study.

  • @prakashsaravanan6613
    @prakashsaravanan6613 2 ปีที่แล้ว

    Fun way of teaching

  • @arrayofsilicon
    @arrayofsilicon 2 ปีที่แล้ว

    Life Saver Thanks 🤯🤯❤‍🔥❤‍🔥

  • @morrismwas5915
    @morrismwas5915 4 ปีที่แล้ว

    Thanks man for these understandable tutorials

    • @codebasics
      @codebasics  4 ปีที่แล้ว

      Morris, I am happy you liked it 😊👍

  • @ajay2552
    @ajay2552 3 ปีที่แล้ว

    Sir I have a doubt. what is the purpose of "--" in git checkout

  • @Debugged_Gamer
    @Debugged_Gamer 4 ปีที่แล้ว

    thankyou for such a clear explanation

  • @ananiashaimbondi1840
    @ananiashaimbondi1840 3 ปีที่แล้ว

    Thank you so much for this video. You earned a Like, Comment, and a new subscriber thanks a mill.

  • @souledone5721
    @souledone5721 3 ปีที่แล้ว

    While using the git reset command i was able to go to the state of my previous commit (in my local git repo). I want this to be reflecting in the github also i.e, I also want my github repo also to be going to my previous state. For this what should I do?

    • @souledone5721
      @souledone5721 3 ปีที่แล้ว

      I think the revert commit does the job but if I want to remove the commits permanently i.e, I don't want anyone to see that I have done something and again reverted back. What should I do in that case?

  • @B-rizzle1251
    @B-rizzle1251 3 ปีที่แล้ว

    Amazing tutorial, saved my project !

  • @islam_basicknowledge
    @islam_basicknowledge 2 ปีที่แล้ว

    When I did git revert and pasted the link , I get an error. Is there a way to send a screen shot

  • @cirusrome4086
    @cirusrome4086 2 ปีที่แล้ว

    Cool -- great tips!

  • @rahultej8352
    @rahultej8352 2 ปีที่แล้ว

    how to revert n number of commits? I mean from the example can I revert to pizza without revert to burger

  • @ambatimamatha6292
    @ambatimamatha6292 3 ปีที่แล้ว

    I have some doubt regarding file missing in GIT
    can I ask you

  • @radhikasharma5550
    @radhikasharma5550 5 ปีที่แล้ว

    hey while doing git revert commit id , is is giving me an error --
    git revert b7af404894467df830bb7aeee9a0bd8ac71d40de
    error: Reverting is not possible because you have unmerged files.
    hint: Fix them up in the work tree, and then use 'git add/rm '
    hint: as appropriate to mark resolution and make a commit.
    fatal: revert failed

  • @NikhilSehgal21
    @NikhilSehgal21 5 ปีที่แล้ว

    I didn't get the difference between Git revert and git reset , both can take us to previous timestamp whichever timestamp log we will use either with Git revert or with Git reset. What's the difference between them?

    • @siddhantg28
      @siddhantg28 5 ปีที่แล้ว +1

      Git reset will remove all the commits in between the current HEAD and the reset HEAD. So once reset happens, you cannot go forward.
      Git revert will not remove the commits. So you can go forward again to latest commits.

  • @karthikkamath2335
    @karthikkamath2335 3 ปีที่แล้ว

    What is the song name or from where can I get the background music played?
    codebasics

  • @ytp1480
    @ytp1480 4 ปีที่แล้ว

    we can get the logs in one-line using, git log --oneline. this way we get shorter code and ease in reading as well.
    another trick in reset is not using --hard. this way only the commits are deleted but the code remains intact.

    • @codebasics
      @codebasics  4 ปีที่แล้ว +1

      Nice tips YT P 👍

  • @vishalmestri
    @vishalmestri 5 ปีที่แล้ว

    Where we can ask question regarding above video... I have observed that when we have two git commits and after that if we try to run "git revert" it does not work...it would be great if you add video regarding same or comment

  • @sarathkumarps6473
    @sarathkumarps6473 2 ปีที่แล้ว

    In order to apply revert change in the remote , git push should be entered.

  • @achonwachris8431
    @achonwachris8431 4 ปีที่แล้ว

    Thanks for this tutorial.

  • @MrChubib0
    @MrChubib0 7 ปีที่แล้ว +1

    you are good at teaching please keep it up :)

  • @ukaigweemmanuel8731
    @ukaigweemmanuel8731 4 ปีที่แล้ว

    so help full. thanks a bunch man!!!

    • @codebasics
      @codebasics  4 ปีที่แล้ว

      Ukaigwe I am glad you liked it 😊

  • @manishsingh3530
    @manishsingh3530 4 ปีที่แล้ว +1

    Awesome bro..

  • @equitymonk34
    @equitymonk34 4 ปีที่แล้ว

    does this mean that on public github repos i can make changes to anyone's repos without needing any permission. since nowhere we were asked for any authentication ?

    • @codebasics
      @codebasics  4 ปีที่แล้ว +1

      Well you can form those repos and make changes but to merge your changes to original repo you need to create a pull request. And only if that repository owner accepts that PR than only your code changes get merged. So short answer is no, you can't make changes to other people's code without their permission.

    • @equitymonk34
      @equitymonk34 4 ปีที่แล้ว

      @@codebasics thank you very much for the clarification.

  • @NomadicDmitry
    @NomadicDmitry 3 ปีที่แล้ว

    Thank you. Very good tutorial and up to the point.

  • @kamalk5962
    @kamalk5962 3 ปีที่แล้ว

    when i write code in pycharm and then run git status command it does not show any changes that needs to be committed and also it does not show the file main.py which is present apart from README.md (it shows readme file only)

  • @Harsh-ug1fq
    @Harsh-ug1fq 5 ปีที่แล้ว

    good, so the git reset will also reset the code on local repository or on remote also?

    • @meetvyas7048
      @meetvyas7048 5 ปีที่แล้ว

      No it is not resetting on the remote , only on the local repo only. If you find a way to reset remote as well please let me know.

  • @pauljyotika90
    @pauljyotika90 6 ปีที่แล้ว

    Hi, this was helpful. But after executing command "git reset --hard 'id' ", changes I can see in my local machine. It's not affected in my server repository.

  • @vishwanathasetty01
    @vishwanathasetty01 2 ปีที่แล้ว

    Hi Man
    Thanks for the video and It will be still more helpful if the commands are in description like
    git checkout -- - undoing before commit
    git revert - undoing after commit - but this will be recorded in log
    git reset --hard - undoing changes after commit - No record in git log also (be careful before using-danger)

  • @darkbanditEX
    @darkbanditEX 3 ปีที่แล้ว

    Great video, thanks

  • @prathameshsagvekar6696
    @prathameshsagvekar6696 3 ปีที่แล้ว

    hello sir, i've found your videos very helpful. this time i required to undo some of my work from repo and followed your video from 07:57. worked well ! but, now 'git status' command returns (Your branch is behind '' by 2 commits, and can be fast-forwarded) . WHAT THIS MEAN ? what to do next ?

  • @MAYOOGHGIRISH
    @MAYOOGHGIRISH 4 ปีที่แล้ว

    Thanks for making it simple

  • @niyaziozturk3967
    @niyaziozturk3967 5 ปีที่แล้ว +1

    Thank you nice demo. You could also say "dash" instead of "minus"..:-)

    • @codebasics
      @codebasics  5 ปีที่แล้ว

      Yes thanks for the tip 👍😊

  • @u123123123123123
    @u123123123123123 6 ปีที่แล้ว

    Great class. but I have one question. if I changed and the added a file but not yet committed, how can I revert the change?

  • @ankur3204
    @ankur3204 4 ปีที่แล้ว

    git commit -am , will not add untracked file...
    We can use it all the time.

  • @ajaykushwaha-je6mw
    @ajaykushwaha-je6mw ปีที่แล้ว

    Anyone can help: after pushing i am getting this error: fatal: main cannot be resolved to branch

  • @ibknl1986
    @ibknl1986 6 ปีที่แล้ว

    Nice and simple explanation. I subscribed to your channel.

  • @divyasrikonatham3346
    @divyasrikonatham3346 3 ปีที่แล้ว

    I accidentally pushed the wrong code in gitlab.How to delete it?

  • @lokeshkumarnatarajan9488
    @lokeshkumarnatarajan9488 4 ปีที่แล้ว

    Useful thank you very much.

  • @netflixandburn
    @netflixandburn 2 ปีที่แล้ว

    The undoing method reverted my code to a commit BEFORE my last one :(
    Just gonna ctrl+c it over lol. Why did they make this so needlessly complicated? Stackoverflow couldn't even agree on a solution

  • @ADAMSIVES
    @ADAMSIVES 7 ปีที่แล้ว

    Excellent. Very helpful thanks.

  • @BikerBytes
    @BikerBytes 3 ปีที่แล้ว

    Nice one, subbed !

  • @raycoustum
    @raycoustum 5 ปีที่แล้ว

    Cool video. But it is important to remark what any component, remote and repository is.

  • @pauljyotika90
    @pauljyotika90 6 ปีที่แล้ว

    In server repository it's not reset to the commit id which I wanted to reset.

  • @shadowthehedgehog2727
    @shadowthehedgehog2727 2 ปีที่แล้ว

    Thank you brother

  • @pixiedev
    @pixiedev 4 ปีที่แล้ว

    Great 👍 i got it.

  • @mi5956
    @mi5956 4 ปีที่แล้ว

    Thank you man, I learned a lot

    • @codebasics
      @codebasics  4 ปีที่แล้ว

      I am glad you liked it

  • @Tall-Cool-Drink
    @Tall-Cool-Drink 3 ปีที่แล้ว

    1:28 - hey...that my son.
    Just kidding....
    Thanks for the video.

  • @devanshgoel3433
    @devanshgoel3433 2 ปีที่แล้ว

    thank you bhai!

  • @santhoshsrinivas4480
    @santhoshsrinivas4480 2 ปีที่แล้ว

    How we can get only commit Id?

  • @chandureddy5208
    @chandureddy5208 4 ปีที่แล้ว

    Cool Video, Thanks!

  • @Pravasith
    @Pravasith 6 ปีที่แล้ว

    Great tutorial. Keep it up!

  • @evilgirl1979
    @evilgirl1979 7 ปีที่แล้ว

    Great tutorial! Many thanks!!! :)

  • @manishayadav1877
    @manishayadav1877 6 ปีที่แล้ว

    But in git reset u use only burger commit I'd how would pizza get reset?

  • @whitecollar_ride2189
    @whitecollar_ride2189 3 ปีที่แล้ว

    Thanks buddy☺️

  • @UnderdogThe1
    @UnderdogThe1 3 ปีที่แล้ว +1

    I had a laughter attack as soon as the video started because of the s3xy music, that was so unexpected hahaha.

  • @ThiagoTemple
    @ThiagoTemple 7 ปีที่แล้ว

    nice video, very helpful

  • @joeuser9690
    @joeuser9690 4 ปีที่แล้ว

    Nice dude

    • @codebasics
      @codebasics  4 ปีที่แล้ว

      Glad you like it

  • @pauljyotika90
    @pauljyotika90 6 ปีที่แล้ว

    Can anyone suggest in that weather I am missing anything.

  • @theboywonder2180
    @theboywonder2180 3 ปีที่แล้ว

    THANK YOU!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • @Argletrough
    @Argletrough 5 ปีที่แล้ว

    Reversion can be used to recover accidentally deleted files.

  • @ayushmishra1252
    @ayushmishra1252 ปีที่แล้ว

    Thanks sir

  • @westfield90
    @westfield90 7 ปีที่แล้ว

    Very nice

  • @arulkumarans902
    @arulkumarans902 11 หลายเดือนก่อน

    vera level

  • @radhakrishna7192
    @radhakrishna7192 2 ปีที่แล้ว

    how to delete/discard "initial commit"

  • @zajurin5151
    @zajurin5151 5 ปีที่แล้ว +1

    awesome

  • @jkouss
    @jkouss 2 ปีที่แล้ว

    Thank you

  • @smarpitsingh
    @smarpitsingh 6 ปีที่แล้ว +18

    3:35 THIS WAS LOL

  • @RahulSharma-lw2ss
    @RahulSharma-lw2ss ปีที่แล้ว

    Nice

  • @doktoren99
    @doktoren99 7 ปีที่แล้ว

    Wheres that song from? Same as BusyWorksBeats uses for his intro :D

  • @rajdave9862
    @rajdave9862 5 ปีที่แล้ว

    Om namah shivay
    Bro I think u should change your channel name from codebasic to code-advanced

    • @codebasics
      @codebasics  5 ปีที่แล้ว

      Har Har Bhole :) Sure I will think about it buddy. :)

  • @wadimovich
    @wadimovich 5 ปีที่แล้ว +1

    Very good video, but the background music really disturbs me! Dizlike!

  • @breathes915
    @breathes915 5 ปีที่แล้ว

    how to change username and email in gitbash

    • @codebasics
      @codebasics  5 ปีที่แล้ว

      That can be done using git config command. Check this: help.github.com/en/articles/setting-your-username-in-git

  • @tahirdevlog2047
    @tahirdevlog2047 4 ปีที่แล้ว

    thankss sir

  • @alwaseem5309
    @alwaseem5309 6 ปีที่แล้ว

    perfection !