Today I figured a pretty cool git command. Up to this day, sometimes I get a bit disorganized with the branches, and git stash
came to save the day (or at least some working stamina).
Here is the procedure:
“Oh no! I forgot to change the branch before making changes”
git stash save "name of the mistake"
Now, moving to the correct branch
git checkout the-correct-branch
Recover the modifications
And, a nice command:
Hypothetical reader, I know what you are thinking. You have some interesting projects, but I am not sure to engage on those because on source hut there is no way to make a pull request (at least, I have never found to the day of this writing).
Well, this make a nice oportunity to learn about patch
in git! So, the magical command I use
where x
is the number of commits that I did or
git format-patch branch-name
where branch-name
is what you expect =] (source).
A nice recommendation by Umgeher is as follows. It will give some information per line, like who wrote the commit or put the tag, for instance. To do so, make a little tweak on ~/.gitconfig
:
[sendemail]
annotate = yes
[tag]
forceSignAnnotated = true
/comments ~lucasemmoreira/opinions@lists.sr.ht?Subject=Re: All praise stash