Difference between initial host and start / master using git pull and git push commands

I'm new to git I have little doubt with the git pull and git push commands.

Example:
          Suppose I have two branches on my local machine, "master" and "newbranch" (local branch).

$ git checkout newbranch

$ git branch

  *newbranch           //Assume this is local branch only 
    master

Now, what exactly do the teams below?

git pull creation wizard → It will pull the changes from the remote “wizard” to “newbranch” (currently the local validation branch).

git pull origin / master -> It will pull the latest changes in "local" "master" to "newbranch" (currently the local checkout branch).

git → "newbranch" ( ) 'remote' "master" .

git push origin/master → ?? ?

- .

                                                         Thanks in advance 
+4
2

git pull origin master git pull origin/master

master "newbranch" ( ).

-
, origin/master , .

, :

git fetch --all --prune

git push origin master

"newbranch" ( ) 'remote' "master".

,
Git master , , , ( git) git .

, ( ) git, .

enter image description here


git push origin/master

.
Git origin/master .

, newbranch, origin/master b newbranch

enter image description here

+2

:

git push <remote> [refspec]

refspec , :

git push <remote>

, git config push.default. git :

push.default "", git , .

git 2.0 git "" , , "git pull" .

:

git config --global push.default matching

"" :

git config --global push.default simple

. "origin/master" - / ( "origin" ). , , . :

git remote add origin/master <git-repository-url>

, git , :

$ git push origin/master
Counting objects: 5, done.
Writing objects: 100% (3/3), 253 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@github.com:sarxos/test.git
   820474f..3706ea9  master -> master
error: unable to resolve reference refs/remotes/origin/master/master: Not a directory
error: Cannot lock the ref 'refs/remotes/origin/master/master'.

:

$ git fetch origin/master
error: unable to resolve reference refs/remotes/origin/master/master: Not a directory
From github.com:sarxos/test
 ! [new branch]      master     -> origin/master/master  (unable to update local ref)
error: some local refs could not be updated; try running
 'git remote prune origin/master' to remove any old, conflicting branches

.

/ ( "origin" "master" ), :

git push origin master
0

Source: https://habr.com/ru/post/1622727/


All Articles