Reputation: 4603
I cloned a repository from the gitserver master. I have done some changes in the local and need to get some debug from others in my team. So I would like to push it to a new branch, which does not exist yet in the remote repo. I would like my local git to create a branch in the gitserver and be able to push it. How would I be able to accomplish it?
ps: I am in the head of local. I do not want to create a branch in the local
Upvotes: 2
Views: 14488
Reputation: 12557
Commit your changes, and then this will take the local master branch and push it to a remote branch without creating a new local branch.
git push origin master:remote-branch-name
If you want to reset your master branch after pushing those commits to the remote branch you can do
git reset --hard origin/master
Upvotes: 5
Reputation: 106440
Create a new branch with git checkout -b <branch_name>
, and push it with git push -u origin <branch_name>
.
Then, everyone can see your branch, and if you need to make changes to it, it's as straightforward as changing to the branch, committing, and pushing it up.
Upvotes: 3