Git fetch and pull with no arguments

Viewed 12534

I have a git branch checked out named foo.

> git status
# On branch foo
nothing to commit (working directory clean)

It was originally checked out using this command:

> git checkout origin/foo -b foo --track

I want to get updates to this branch from the remote repository. I know that either of these commands will suffice:

> git fetch origin foo # ignore the lack of merging
> git pull origin foo

If I omit the arguments to fetch or pull, will git default to fetching (or pulling) the branch that I currently have checked out? That is, are the following pairs of commands equivalent?

> git checkout foo
> git pull

and

> git checkout foo
> git pull origin foo
3 Answers
Related