Sahil Rajput
Sahil Rajput

Reputation: 395

Forcibly copying a branch from another branch?

$ git branch -C pommi  # works fine, creates branch forcibly out of currently checkedout branch.
$ git branch -C pommi master  # gives error, why???
fatal: Cannot force update the current branch.

I know that -C is for forcibly copying the branch, when a branch already exists with the same name. How can I create a force copy by explicitly specifying the branch name(which is not checked out) of the source branch to copy?

Upvotes: 2

Views: 555

Answers (1)

Sahil Rajput
Sahil Rajput

Reputation: 395

Acutually, it was a problem in understanding the syntax for copying, its like

git branch -C sourceBranch targetBranch

So, It's solved, Thanks StackOverflow, and community people.

Upvotes: 1

Related Questions