FreeKB - How to pull a file in Git
How to pull a file in Git

Home > Search > How-to


If you are not familiar with Git, check out our getting started article. These examples are based on Linux.

The pull command pulls a file from your master Git repository into your local Git repository (branch). For example, let's say the root directory of your master Git repository is /var/git and the root directory of your local Git respository (branch) is /home/john.doe/git. Let's also say that you want to pull /var/git/foo.txt into your local Git repository. To do this, you must first be in your branch.

cd /home/john.doe

 

You can then use the git pull command to pull foo.txt from the master Git repository into your local Git repository.

git pull

 

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

Already up-to-date.

 

The -q or --quiet option can be used to suppress output. These options are useful when using git in a script.

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 in the box below so that we can be sure you are a human.




Comments