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
Search - "commit not stash"
-
WTF PEOPLE!!
Some people really need to read their error messages.
Just now I got this teammate asking me how he should handle the error git returned. The error message stated: "Please commit your changes or stash them before you merge." He asked me what he should do to fix the error... I was astonished by his stupidity that he did not read the fucking error message.
Almost every fucking time a teammate comes to me with the question how to fix an error, there is a message that says how to fix the error. Why don't they read them?!?! I told you so many times to read your fucking error messages!!!
I'm really glad the project is over in a couple of weeks and I get a new team..2 -
I love git stash.
It's helps a lot for doing refactors to me. I guess it's not the most complex workflow, but it wasn't obvious to me when I started with git. Let me explain.
Refactors. As you start writing the first lines of a refactor, you start to notice something: you're changing too many things, your next commit is going to be huge.
That tends to be the very nature of refactors, they usually affect different parts of code.
So, there you are, with a shitload changes, and you figure "hey, I have a better idea, let me first do a smaller cohesive commit (let's call it subcommit) that changes a smaller specific thing, and then I'll continue with the upper parts of the refactor".
Good idea, but you have a shitload of changes nearly touching every file in your working copy, what do you do with these changes? You git stash them.
Let's say you stash and try to do that smaller "subcommit". What sometimes happens to me at this point is that I notice that I could do an even smaller change inside this current "subcommit". So I do the same thing, I git stash and I work on that even smaller thing.
At some point I end up `git stash pop`ing up all these levels. And it it shows that git stash is powerful for this.
* You never lose a single bit of work you did.
* Every commit is clean.
* After every commit you can run tests (automated or manual) to see shit is still working.
* If you don't like some changes that you had git stashed, you can just erase them with git reset --hard.
* If a change overlaps between a stash you're applying and the last "subcommit", then
if they differ, git shows conflicts on the files,
if they are identical, nothing happens.
with this workflow things just flow and you don't need to wipe out all your changes when doing simpler things,
and you don't need to go around creating new branches with temp commits (which results in bloated temp commits and the work of switching branches).
After you finish the refactor, you can decide to squash things with git rebase.
(Note: I don't use git stash pop, because it annoys the fuck out of me when I pop and you I get conflicts, I rather apply and drop)4 -
Dev Confession:
I wrote a bunch of code today that created more problems than it solved. I did not commit it. I used git stash to hide it. It took me hours to write. I didn't do a test on a small section of code beforehand. Literally hours of wasted man hours.
At least I didn't commit this garbage into the repo. The approach was fine, but the architecture made it a non-solution. Now I need to redesign this code or leave as is. It is production code I cannot just "change" on a whim.
I have officially dubbed this week as confession week. This should be a world wide thing. People should fess up to their terrible deeds. Lets start a trend and confess to our misdeeds in code and life. Make the world a better place!
What do you say?6 -
temp commits are generally more useful than git stash.
instead of stashing, do a commit with a message like "THIS IS NOT A COMMIT, DON'T INCLUDE THIS". with some discipline you can then go back to your branch, `git reset --soft HEAD~1` and voila, it's similar to a `git stash pop`.
but it's better because you can do this in multiple branches at the same time and there's no fear of accidentally dropping some stashed commit.5 -
So I stashed my changes to switch branches and quickly fix a f**k up, then I switched back and went to 'pop' the stash.... only I didn't click 'pop' I clicked...'delete' and GitKraken or ShitKraken as it should be called, didn't ask for confirmation... it just deleted all my changes. FMLdevrant fml commit not stash stashshit git gitkraken little and often shash commitment issues version control5
-
Git: "Your local changes to the following files would be overwritten by checkout. [...]
Please commit your changes or stash them before you switch branches.
Aborting"
Fucking nitpicking, that's not "Aborting", that's meant to be:
"Dear user, would you like to overwrite your current changes, even more so as you are currently in a so-called detached head state anyway, as you obviously just checked out an old tag to try a temporary rebuild of an old project state."
Yes, the build targets are checked in, as this can be very useful in some scenarios.
It's just! some! CSS! from the SCSS!
Stop "Aborting"!4