git origin/branch and git origin branch what’s the difference?

Asked

Viewed 153 times

0

When I need to update the local repository, I usually run the command git pull or git pull origin/branch.

The git pull origin/branch as far as I understand "pull" what you have on the remote branch (the origin indicates the remote repository), now I saw that also works the syntax git origin branch and I didn’t understand the difference.

It looks like they both update the local repository with the contents of the remote branch, but why does it have this variation?

They do the same thing?

1 answer

0

Try to execute the command

git origin master

or replace master by the name of any branch, the console output should indicate that origin is not a valid command. Checks to see if you are typing the correct command.

  • 1

    I think it refers to syntax, because one has / and the other not? One command is written git pull origin/branch and the other git pull origin branch pq?

  • Got it, I particularly only knew the command git pull origin branch, had never tried to use git pull origin/branch, I was tested now out of curiosity and returns that origin/branch is not a git repository.

  • branch has to be the branch name

  • Yes, I set branch because it could be any name, but the command I specifically tested was git pull origin/master

  • @Marceloivanofre the doubt was exactly what @hugcsl commented, the difference between the two, because for me there is no mistake, and I noticed that the same happens with the git reset origin master and git reset origin/master

  • @Ricardopunctual Look, I was curious about the subject and I found this link of another answer https://stackoverflow.com/questions/2883840/differences-between-git-pull-origin-master-git-pull-origin-master, he answers your question, if you read the comments of the answer you will realize that git pull origin/branch became an invalid command from certain versions of git. I hope I helped.

  • will that be it? I use that application "Git Cmd" for windows, I will update or use another to test

Show 2 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.