+2 votes
1 view
in Devops and Agile by (25.5k points)
edited by

I created a local branch that I want to 'push' upstream. There is a similar question here on Stack Overflow on how to track a newly created remote branch.

However, my workflow is slightly different. First I want to create a local branch, and I will only push it upstream when I'm satisfied and want to share my branch.

  • How would I do that? (my google searches did not seem to come up with anything).
  • How would I tell my colleagues to pull it from the upstream repository?

1 Answer

+2 votes
by (42.7k points)
edited by
 
Best answer

If you want to create a branch from the current branch

git checkout -b {your_local_branch_name} 

For creating a branch from a remote branch 

git checkout -b {your_local_branch_name} origin/<remote_branch_name>

After editing the files 

git add -A or git add <each_file_names>

git commit -m 'your commit message'

git push -u origin <your_local_branch_name>

Which basically add, commit and pushes your file 

For updating

git pull origin master

For more information please go through the following tutorial to get more info about git:

by (25.5k points)
This worked to me thanks for suggestions.
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...