DEV Community

Discussion on: Learn git concepts, not commands

Collapse
 
prahladyeri profile image
Prahlad Yeri • Edited

One caveat you should mention is that "git push" doesn't always work on some git installations, especially POSIX ones like Linux. You may have to qualify with the remote repository for it to work:

git push origin master
Enter fullscreen mode Exit fullscreen mode

But otherwise, its super informative and well written article.

Collapse
 
unseenwizzard profile image
Nico Riedmann

With git 2.0 introducing the simple push strategy as default setting, I was under the impression that you generally wont need to qualify the remote you're pushing to, as long as it's set as upstream and has the same name as your local branch (which it is if you don't go out of your way to have it differently).

Or am I wrong about something there?

Collapse
 
prahladyeri profile image
Prahlad Yeri • Edited

Yep, it considers the current branch (origin/master) as the default if git config --global push.default setting is set to current. This is usually set by default on windows and ios, so simply doing "git push" might work but on some linux distros, this setting isn't set to current but set to nothing instead (which means you'll have to explicitly add the branch).

Especially, the last time when I'd worked on Ubuntu, simply doing a git push had not worked.

Thread Thread
 
unseenwizzard profile image
Nico Riedmann

As far as I understood it, the "new" (git 2.0 is from 2014) default is simple.

From the git doc:

When neither the command-line nor the configuration specify what to push, 
the default behavior is used, which corresponds to the simple value for push.default: 
the current branch is pushed to the corresponding upstream branch, but as a safety measure, 
the push is aborted if the upstream branch does not have the same name as the local one.
Enter fullscreen mode Exit fullscreen mode

Of course it may still be that some distro installations either install older versions, or install with a non-default configuration. Somewhat recently having set-up my work laptop on Ubuntu 18.04 I do not recall having to set the push configuration

Thread Thread
 
bugtester46 profile image
bugtester46

TEST

Collapse
 
jamesanderson13 profile image
JamesAnderson13

Very interesting information, I really like it because it can add insight for me more broadly, thank you very much for this extraordinary information

tutu app