Smiling person, father of two, Husband, Senior Developer/Architect (in that exact order, it's important)
Experience in development since 2004
Linux user and advocate since 2001
Smiling person, father of two, Husband, Senior Developer/Architect (in that exact order, it's important)
Experience in development since 2004
Linux user and advocate since 2001
alternatives
So here you are trying to provide an alias for something that exist in a very limited way:
git cherry
I don't know why no one use it, but I do.
It won't full achieve your need, but it provides almost the same.
you compute the current branch
you are using git branch --show-current because you want to add it to the
master...
thingYou could play with stack overflow to get the name of the branch from where the current branch come from.
You will find a lot of outdated thing using
rev-parse
,symbolic-ref
ordescribe
... I'm not sure which one but it's around this.But you simply doesn't need it, you can simply use
master...
that's it it works.the three dots.
usually two are enough.
Then about the master
your code only works if your default branch is
master
(it doesn't work when it'smain
ordevel
... )It also doesn't work when you create a branch from another one, think about a bug fix in a feature branch.
here you can use
@{upstream}
alias, it works when your branch has an upstream.it's not about a remote named upstream, but an internal thing.
Here is what I would use
this won't work when you didn't set up an upstream to your branch.
There are way to find the first commit of your branch
conclusion
have fun, I will keep using
git cherry -v
no one knowsInteresting !
I didn't knew about
git cherry
As i always say, there is an infinite way to solve a single problem !
I just learned, i can do the same with
git cherry -v origin
!Awesome, thank you !
about the 3 dots vs 2 dots thing
Some Git commands take commit ranges and one valid syntax is to separate two commit names with two dots
..
, and another syntax uses three dots...
.What are the differences between the two?