Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
+2 votes
2 views
in DevOps and Agile by (29.3k 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?
closed

1 Answer

+2 votes
by (50.2k 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:

How do you create a remote Git branch? -git create remote branch
Intellipaat-community
by (29.3k points)
This worked to me thanks for suggestions.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...