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 in Others by Rahul
• 8,980 points
25 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 by Aditya
• 7,280 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 in Others by Rahul
• 8,980 points
20 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,340 points
419 views
0 votes
0 answers

How to open a new tab or a new window while writing an exam in AI - Onlime Remote Proctored

How to open a new tab or ...READ MORE

Jul 20, 2020 in Others by vimalkamal
• 120 points
2,216 views
0 votes
1 answer

How to Navigate to a new screen and back?

Hi@akhtar, Most apps contain several screens for displaying ...READ MORE

answered Aug 26, 2020 in Others by MD
• 95,340 points
174 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
1,592 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 in Others by Aditya
• 7,280 points
17 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 in Others by Aditya
• 7,280 points
26 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP