0

Is it possible to do `git merge' in git without manually switching to the branch I want to merge changes into? In git rebase one can do:

 git rebase <BRANCH_A> <BRANCH_B> 

Git would then perform automatic checkout to for me. But in case of merge, if let's say I want to merge dev into master this doesn't seem to work:

 git merge --no-ff dev master 

Git says `Already up-to-date. Yeeah!'. It does say so because if I checkout branch dev from master and don't leave it's obvious that dev is up to date with both dev and master. So is it possible to do an automatic checkout in merge case? If no, is there any idea behind it or is just the way git designers did it?

1 Answer 1

1

The man page for git merge does not reveal such an option. But you could write a bash function to do it and place it into you .bashrc file.

git-mergeinto() { git checkout $1 shift git merge $@ } 

Its calling syntax would be:

git-mergeinto <branch-to-merge-into> [options] <branch-to-merge> 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.