Let's say, you're on your terminal and you want to have the list of commits from your current branch !
There is some tricks to do that, the faster one is just to git log and scroll !
But i found useful to made a simple alias to do so !
As you can see, this is quite simple, it's a combination of 2 main commands i set up in my ~/.gitconfig
as an alias :
[alias]
; to list commits from the current branch
commit-list = !git log --no-merges --oneline --decorate master..$(git branch --show-current)
HOW
- First, i need to get the branch where i am right now, and to do that, i use
git branch --show-current
- Second, am going to compare with
git log
, the difference commits from my branch to the master branch, because i don't want merges, nor too much details, i added two flags,--no-merges
and--oneline
+ a simple--decorate
.git log --no-merges --oneline --decorate
DEMO
PS: Don't worry about the "passphrase" on the demo, i added a lot of security checks for any git command on my local machine, i may do a future post about that soon !
EDIT : From Christophe Colombier, you can do the same thing with a native command, such as : git cherry -v origin
Thanks for reading, feel free to like and/or subscribe for more 🐼.