3 ms·
I never managed to find how do I revert changes in a file with git, I only needed it once so far, and I had to ask a friend to do it for me, and I still dont kn
by LoneWolf 15y ago
I never managed to find how do I revert changes in a file with git, I only needed it once so far, and I had to ask a friend to do it for me, and I still dont know how to do it, tried search how and it got me even more confused.
While I recognize it may have its advantages, I dont see them yet (except for being distributed)
Note that I have not used git that much yet, maybe I just need to adapt to it (the documentation does not help much either), but I adapted to subversion a lot faster.
Someone mentioned merges I had a few problems with them with subversion, git never did one so I cant tell.
- nessus42 15y agoI never managed to find how do I revert changes in a file with git I'm not sure why anyone should think this hard to do. When you do "git status" it even tells you how to do it: git checkout -- myFile That will replace any changes to myFile that haven't been checked in yet with the most recent version that was checked in. If you want to go back to an older version, you can do git checkout a2791d14adf3 myFile where that funky number is any unique prefix of the commit identifier that "git log" shows you. Well, that's if you haven't "staged" your changes. If you've staged the changes, you have to "reset" the staging for the file first. I admit that this staging thing is a bit confusing, so I rarely stage anything. There's no reason that you need ever "stage" anything in Git if you don't want to, so I'm not sure that that bit of extra complexity is worth worrying about.
- LoneWolf 15y agoThanks for that, spent a lot of time googling and never found that, maybe I didnt search properly, the solutions I remember finding always involved more than one command and were confusing.