Re:High-Level Problems with Git and How to Fix Them
by shaan7 on Tuesday December 12, 2017 @03:20AM
(#15903874)
Just keep a copy of the `.git` dir before you try the complex operation. If you screw it up, restore it back and voila!
[ Parent
| on HN ]
Re:High-Level Problems with Git and How to Fix Them
by sigjuice on Tuesday December 12, 2017 @03:28AM
(#15903906)
No. This does not safeguard any uncommitted files.
Re:High-Level Problems with Git and How to Fix Them
by nicoburns on Tuesday December 12, 2017 @05:12AM
(#15904334)
Leaving any files uncommitted before a complex operation in git is a really bad idea (make a temporary commit if necessary). It's almost impossible to completely lose committed data, but pretty easy to destroy uncommitted data.
Re:High-Level Problems with Git and How to Fix Them
by xinsight on Tuesday December 12, 2017 @10:30AM
(#15906231)
This. I also do a `git diff > save.patch` if there is something uncommmited that i don't want to commit at the moment. A patch file feels more comfortable to me than git stash, as i can easily view the patch files, and reapply them with `patch -p1 < save.patch`
Re:High-Level Problems with Git and How to Fix Them
by lpr22 on Tuesday December 12, 2017 @08:24PM
(#15911222)
You can show the diff with `git stash show` or also apply your patch with `git apply save.patch`
Re:High-Level Problems with Git and How to Fix Them
by jononor on Tuesday December 12, 2017 @10:13AM
(#15906082)
No. Commit your changes and mark it. For instance by creating a branch.
git commit -a git checkout -b before-complex-operation ...
To get back to where you were, git checkout before-complex-operation