How do I push a new local branch to a remote Git repository and track it too

0 votes
I want to be able to create a local branch based on another either remote or local branch going through git branch or git checkout -b). I also want to push the local branch to the remote repository but, however, want to make it trackable so git pull and git push will work immediately. How do I do that? I know about --set-upstream in Git 1.7, but that is a post-creation action. I want to find a way to make a similar change when pushing the branch to the remote repository.
Feb 22, 2022 in Others by Rahul
• 9,680 points
787 views

1 answer to this question.

0 votes

In Git 1.7.0 and later, you can checkout a new branch by using:

git checkout -b <branch>

Which will help in Editing files, add and commit following which, it will then push with the -u (short for --set-upstream) option:

git push -u origin <branch>

Git will set up the tracking information during the push.

answered Feb 22, 2022 by Aditya
• 7,680 points

Related Questions In Others

0 votes
1 answer

How do I check out a remote Git branch?

The answer to your question has been ...READ MORE

answered Feb 10, 2022 in Others by Rahul
• 9,680 points
839 views
0 votes
1 answer

How do I get it to select a single row based on the value?

Try this: Sub MoveBasedOnValue2() Dim ...READ MORE

answered Jan 20, 2023 in Others by narikkadan
• 63,600 points
618 views
0 votes
1 answer

Excel - How do I round a date type to the next hour if it is more than one minute

Add almost 30 minutes and it'll get ...READ MORE

answered Mar 27, 2023 in Others by narikkadan
• 63,600 points
394 views
0 votes
1 answer

How do I start studying Node.JS to create a restful API?

Node.js is an open source server environment ...READ MORE

answered Jun 11, 2019 in Others by ArchanaNagur
• 2,360 points
1,002 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,079 views
+2 votes
1 answer
0 votes
1 answer

How do I get the current date and time in PHP?

The time would go by your server ...READ MORE

answered Feb 16, 2022 in Others by Aditya
• 7,680 points
734 views
0 votes
1 answer

How to create an HTML button that acts like a link

To answer your doubt, the plain HTML ...READ MORE

answered Feb 17, 2022 in Others by Aditya
• 7,680 points
4,500 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP