DEV Community

Cover image for How to merge a branch when you forgot it's name ? -Git
Djilou
Djilou

Posted on

How to merge a branch when you forgot it's name ? -Git

Have you ever wanted to merge a working branch after a checkout to master but you suddenly forgot the name of your working branch ? then reach to your tasks manager or hit a "git branch -a " to check all the branches just to get even more confused ?
well i have a little tip for you !

let's say that this is your working branch

Image description

now let's head to the master branch using
"git checkout master"
and to merge our working branch we just need to use this command

Image description

what this does is that it refers to the previous visited branch as "-".
So basically it's like saying:
"git merge previousVisitedBranch"

ps:it works also with "git checkout"

*try it yourself ! *

Happy coding

Top comments (0)