Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
duckWit56166yAlso, git stash -u will also stash new files (un-tracked) in the workspace that haven't been added to the repo yet.
-
fuck, I know that too!
...
I know I'll show off with something else...
whenever you fuck up things in git, like in a rebase, and you lose reference to a specific commit, run git reflog, and you will see a history of all commits globally... -
Awlex177456y@duckWit Also nice to know.
I'll open the manuals for this command, or else I'll miss some other nice features. Thanks! -
Root797536y@erandria I always think "re-flog" when I read or type that command.
"I flogged thee once, and by the devil I will flog thee again!" -
@Root lol... there was this old satire interview with linus (as in fake) where linus said that rebase was a joke, a reference to freebase.
I actually didn't know it was satire until moments ago while googling that, and I wasn't the only one apparently:
https://stackoverflow.com/questions... -
Root797536y@erandria 😅
I should totally read through git's source someday. I'd learn quite a bit. -
nibor48136yMy most common use of stash is when I make a load of changes before realising I'm on the wrong branch. A daily occurrence for me.
I didn't know about the -u flag though, that's today's lesson learnt! -
ddephor44466yIf you're on a feature branch (and you should be...), you do not need to stash, just commit the changes (with reasonable commits, may be more than one), You can clean up the branch afterwards.
If you were on master (which you shouldn't), you can just checkout a new branch and commit the changes to that branch.
In both cases you're fine to change to whatever must be done immediately.
Just always keep in mind that branches are cheap in git. Use many of 'em. -
ddephor44466y@beegC0de Sure. Never used bisect? Never had a bug and needed to know when it was introduced?
Try it, it may seem to be a simple feature as you could checkout the same way manually, but then you have to keep track of the status. It relieves you're brain and gives you more room to concentrate on important aspects of debugging. -
@ddephor I've fallen in love being able to open a console with Ctrl P, typing history, then the file name, and getting all commits where the file was changed and what has changed bit by bit
-
ddephor44466y@beggarboy That's an odd way to limit yourself. git log and its gazillions of options are way more powerful than the shell history and git blame is also helpful.
And if you don't know where the bug comes from, you can't search for a file.
Seems like you have been using git mainly for yourself. In this case you won't need the complex parts of git, because you will almost never conflict with yourself or make changes you're not aware of. But if you're working on a big codebase with more people it's not as easy as grepping the history. -
@ddephor I don't think you're quite following. I am referring to GitKrakens history, not any git shell command.
-
ddephor44466y@beggarboy Ah, ok. I only use git on the command line. Mainly because I don't like the odd and confusing command naming of most git GUI clients (and I really don't understand why pure git clients need to invent their own naming of git commands) and because I haven't found one that supports all everday git procedures. They all fail when the going gets tough.
-
@ddephor git bisect is so underrated. I haven't seen people using it in their projects.
-
ddephor44466y@swisspencilcase Yes, right. In fact it's quite a simple feature, but it can show you where to start the search for a bug.
And I think many developer assume that it's complex and hard to use, but it's not. -
@beggarboy GitKraken shits itself the very moment you try to change, commit and push a submodule (which is really the only way to easily develop dependencies together with their dependents, and it works fine in the CLI.
My coworker enlightened me with git stash. Just :woah:
random
git stash