5 ms·
Hmm, maybe I should leave as-is, for the time being, anyway! Thank you! Update: based on other comments, I WILL seriously look into replacing the use of checko
by garyrob 4y ago
Hmm, maybe I should leave as-is, for the time being, anyway! Thank you!
Update: based on other comments, I WILL seriously look into replacing the use of checkout. It sounds like these newer features are probably stable enough for the simple things that are being done in the blog post, and that updating the post will more it a bit more useful as a starting point for learning git.
I'm thinking of posting the modern syntax as an alternative rather than a replacement to checkout, but I have yet to investigate how stable things are now... will do when I have time.
But meanwhile, the checkout method is fine, it works, and it's well-established for many years.
- NoahKAndrews 4y agoI think this Reddit comment has the right idea, especially now that those commands have been released for 3 years: https://www.reddit.com/r/git/comments/ifkbfz/comment/g2on6yo/ https://www.reddit.com/r/git/comments/ifkbfz/comment/g2on6yo...
- malkia 4y agoThank you, and that's a good advice from the comment: "So if you're writing a script that needs to work with dozens of past and future Git versions, use git checkout. If you need to teach humans how to talk to Git, use git switch. Some details of some flags may change in the future, but I'd argue that that'll be a smaller mental challenge than trying to teach which parts of git checkout do what." I'll try to use more switch/restore I've actually used "git stash" more than it should be (I'm probably applying real bad "p4/g4/svn" like ideas in my head to the development. As soon as I go into project with few more people, and I'm lost, though I was able to make few PR's in github for things - but everytime had to le-learn the process).
- noSyncCloud 4y agoOnly used Git and SVN before, sorry for noob question. I guess p4 is Perforce, but what is g4?
- erik_seaberg 4y agoInternally Google started on Perforce and gradually replaced its backend. Their client (not available outside their org) is g4 rather than p4. Some dedicated/stubborn devs also used to (maybe still do?) manage local history in a git-based tool with pushes on demand to a g4 changelist for review.
- noSyncCloud 4y agoAhh awesome, ok, thanks so much for the lesson. Something to read more about. Cheers.
- malkia 4y agogit5 or something - is this still supported? g4 was awesome (still miss it, now just on perforce...)
- erik_seaberg 4y agoI wouldn’t know anymore, but I hope it’s still viable.
- ziml77 4y agoI sometimes use git stash as a safer alternative to git reset --hard HEAD. git stash -> check that the state you've reverted to is actually what you want -> git stash drop. And since internally stash is just creating a commit, it's even possible to recover the changes if they haven't been garbage collected.
- malkia 4y agoI'm actually really bad... git stash git pull git stash pop # running away to hide myself from the git gods....
- RexM 4y agoI do this… why is it bad?
- malkia 4y agoI thought so, like I'm not putting much thought behind it of sorts, also it puts into uncomfortable sitatutions sometimes should I merge, or forward something, or who knows what...
- test1235 4y agoIf you do that a lot, look into `autostash` (as I do), which does that automatically for you https://stackoverflow.com/a/30209750 https://stackoverflow.com/a/30209750 https://leosiddle.com/posts/2020/07/git-config-pull-rebase-autostash/#git-pull-rebaseautostash https://leosiddle.com/posts/2020/07/git-config-pull-rebase-a...