Reputation: 4536
How can I clone a specific branch and push changes to this branch only in GIT. I know how to clone a specific branch but not sure to how to push to this branch only. As there is no chance of mistake so if someone can mention the series of step that will be great. To clone repository, I tried below.
git clone -b <branch_name> <url>
Upvotes: 0
Views: 2931
Reputation: 4536
Clone only your specific branch
git clone -b <Your_Branch> <URL of git_repo>
Check you are in correct branch
git branch -a
output will be like below
*Your_Branch
remotes/origin/master
* mark will tell in which branch you are in.Now go inside the cloned repository and run git commands to push your changes to git.
cd git_repo
git add *
git commit -m "Did changes/added new files"
git push
Above will push files into Your_branch only.
Upvotes: 0
Reputation: 469
clone a specific branch
git clone -b <branch> <remote_repo>
push to specific Git branc
git checkout YourBranch
git push origin YourBranch
Upvotes: 3