FreeKB - Git (Version Control) git pull command
Git (Version Control) - git pull command

Let's say you've cloned a repository named foo.git to a directory on your local PC using the git clone command.

git clone ssh://git@example.com/path/to/foo.git

 

Both the git pull and git fetch commands downloads files from the origin Git repository to your branch (e.g. the directory on your local PC that contains the cloned origin repository). The git checkout command can be used to download one or more files.

If your branch already contains a file that is also in the origin Git repository, and there are differences between the files, git pull will attempt to integrate and merge the differences into the files in your branch.

git fetch will download but not merge or integrate any differences between similar files

 

The git pull command without any options will pull files from the origin repository.

git pull

 

The git remote command with the -v or --verbose flag can be used to display the URL of origin.

git remote --verbose
. . .
origin  ssh://git@example.com:7999/path/to/example.git (fetch)
origin  ssh://git@example.com:7999/path/to/example.git (push)

 

The git branch command with the -a or -all flag can be used to display all of the branches in the repository.

git branch --all

 

Which will return something like this.

* master
  remotes/origin/HEAD
  remotes/origin/feat/logging
  remotes/origin/master

 

Or you can include origin followed by the name of a branch you want to pull from, such as master.

git pull origin master

 

Or some other branch, such as feat/logging.

git pull origin feat/logging

 

The prior command will return "Already up-to-date" if your the files in your branch are the same revision as the files in the origin Git repository.

Already up-to-date.

 

The -q or --quiet option can be used to suppress output.

git pull --quiet

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 9699f in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |