You're confusing a few things. https://my.company.com/appid/WebApp/tree/DEV
is not a "branch". It's the url of a remote repository. The tree/DEV
looks extraneous. This repository can contain multiple branches and can be exposed via. HTTP (which is what it looks like is being done here). From the url, it looks like the branch on which development is done is called DEV
. This is confusing since you say that you have something on master
. Can you double check this using the git branch
command? Let me restate your situation to make sure I got it right.
- You've cloned from a repository (let's call it
origin
).
- Made some changes on a branch
X
(I think it's DEV
but you say it's master
).
- Cannot push the updated
X
back to origin
- Want to push
X
to a different repository https://my.company.com/appid/WebApp/tree/DEV
(let's call this mine
).
If this is what you need, your problem is easily solved. All you need to do it to add mine
as a new remote using
git remote add mine https://my.company.com/13179069/WebApp/tree/DEV
Now you can push your branch to mine
like so
git push mine X
This is pushing the same branch onto a different remote.
If OTOH, you really want to move commits from one branch to another as you've stated in your question heading (but which I doubt), you'll need to do the following.
Let's assume that the original repository looked like so when you cloned from origin. C4 is the commit that's currently master
.
C1 - C2 - C3 - C4 (master)
Now you made some extra commits and your local repository looks like this
C1 - C2 - C3 - C4 - C5 - C6 - C7(master)
Oops! These 3 extra commits should have gone onto another branch. First thing you do, create a branch dev
at this point.
git branch dev
Now, it looks like this
C1 - C2 - C3 - C4 - C5 - C6 - C7(master, dev)
Now, we'll make master
move back to the origin location (C4).
git reset --hard master C4
Now, it looks like this
C1 - C2 - C3 - C4(master) - C5 - C6 - C7(dev)
Now, you can add your own repository as a new remote (say mine
) and then push dev
to it like I've mentioned above.