Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (29.3k points)

I have been using git for a while now, but I have never had to set up a new remote repo myself and I have been curious about doing so. I have been reading tutorials and I am confused about how to get "git push" to work.

If I simply use git push it asks me to see up a default branch(?) to point to? What is the difference between these two options it supplies me with?

git config --global push.default matching

git config --global push.default simple

Matching just pushes whatever branches I have on my local repo, and if they don't match I have to then manually tell it to push whatever new local branches I have, correct? Is this best practice to use or is it simple best?

1 Answer

0 votes
by (50.2k points)

Let’s see the difference between push default matching and simple

Default matching is used for pushing all branches

git config --global push.default matching

This command is used to push all the branches to the remote branch and would merge them. If you don't want to push all branches.

you can push the current branch only using default simple 

git config --global push.default simple

This command is used to push the individual branch to the remote branch and using this option and push your code branch by branch. It's better to push branches manually and individually.

These are the major differences between push default matching and simple.

Reference: https://git-scm.com/docs/git-config#Documentation/git-config.txt-pushdefault

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...