1

I have 3 branches:master,dev and test,on branch test how can I merge dev to master.for some reason I can't checkout to master.

luoziluojun
  • 116
  • 10
  • Hi, Please try this. The first answer is the straightforward approach you can follow - https://stackoverflow.com/questions/3216360/merge-update-and-pull-git-branches-without-using-checkouts – Arora20 Sep 16 '17 at 08:17
  • use git-worktree to checkout to another directory and perform the merge there – max630 Sep 16 '17 at 08:21

1 Answers1

1

try this

git fetch . dev:master

The syntax of command is

git fetch <remote> <source>:<destination>
Roman Marusyk
  • 23,328
  • 24
  • 73
  • 116
  • It workes,but I could not find any instructions from official document about '.' – luoziluojun Sep 16 '17 at 08:31
  • 1
    This is not a merge, this is just a fast-forward. @Blackhole: `.` means "the current repository". This tells Git to call *itself* up over the Internet-phone, import its *own* `dev` (`dev` is the source part of the refspec), and try to set its own `master` (`master` is the destination part of the refspec) to match the "other" Git's `src`. Since there is no `+` in the refspec, the set is a non-forced, fast-forward-only operation. – torek Sep 16 '17 at 11:33