News for hackers. Stuff that matters.
Re:Hg Init: A Mercurial Tutorial by jefozabuss on Friday July 22, 2022 @07:40AM (#32190887)
I still save changes to a file if I switch/merge while having a bigger changeset as I use PHPStorm and it caused me a semi heart attack at least 3 times with the “unstashing failed“ error (that also removed it from the stash at the same time)
Re:Hg Init: A Mercurial Tutorial by rr888 on Friday July 22, 2022 @08:41AM (#32191293)
The best thing about Jetbrains IDEs is local file history - so you dont have to rely on git - you can still see file history and directory history to restore commits and deleted files. Saved me many times.
Re:Hg Init: A Mercurial Tutorial by felixthehat on Friday July 22, 2022 @09:27AM (#32191664)
VS Code added that feature too recently, very nice addition https://code.visualstudio.com/updates/v1_44#_timeline-view
Re:Hg Init: A Mercurial Tutorial by rr888 on Monday July 25, 2022 @10:25AM (#32224739)
Thanks I didn't even know that was there, this will help me. It looks like its files only, not directories which is important to get accidentally deleted files.
Re:Hg Init: A Mercurial Tutorial by speed_spread on Friday July 22, 2022 @05:13PM (#32197191)
Local history is great and I dont understand why it's separate from the undo stack, which is limited in size (by default?). Actually, both could be integrated with SCM as fine grained autocommits + eventual squash on manual checkpoint / push.
Re:Hg Init: A Mercurial Tutorial by nicoburns on Friday July 22, 2022 @08:58AM (#32191421)
The other option here is to do a "WIP" (work in progress) commit. Which you can undo (moving the files back into the staging area) with `git reset HEAD^` once you switch back to the branch. Annoying that this is necessary - it would be great if git stash was as robust - but this won't lose your work.
Re:Hg Init: A Mercurial Tutorial by guitarbill on Friday July 22, 2022 @10:18AM (#32192090)
You can also use `git stash apply` (which doesn't pop the stash), followed by maybe merging, and finally a `git stash drop`.
Re:Hg Init: A Mercurial Tutorial by GauntletWizard on Friday July 22, 2022 @09:19PM (#32199238)
You can also use the git reflog to get the recently dropped stash commit's sha, and then check out the files that you miss.
Re:Hg Init: A Mercurial Tutorial by Cederfjard on Friday July 22, 2022 @08:28AM (#32191210)
If a change has ever been committed or stashed (which is basically also committing, just not on a branch), it can always be recovered, at least until garbage collection is run - check out the reflog. Of course, if it hasn't been, then you can lose it.
Re:Hg Init: A Mercurial Tutorial by nicoburns on Friday July 22, 2022 @08:59AM (#32191427)
Yeah, working out which stash contains your work can be quite tricky though! As they are not named by default.
Re:Hg Init: A Mercurial Tutorial by vbernat on Friday July 22, 2022 @08:35AM (#32191263)
You can add a tag to the change you want to keep. Whatever you do, you can recover it (git reset --hard tag). Once you are done, remove the tag. Otherwise, there is the reflog, like mentioned in a sister comment.
Re:Hg Init: A Mercurial Tutorial by rubyist5eva on Friday July 22, 2022 @08:44AM (#32191306)
standard branches can serve this purpose