Pulling Code from a Repository
One you have installed Git on your computer and cloned the repository for the first time, you are ready to check for updated pieces of the code in the repository to download. This is called “pulling” in Git.
When you command Git to do a pull, you are downloading only the newer files that exist on the repository to your local machine. In other words, you are bringing your local copy of the software code up-to-date by downloading only what is necessary to bring your code up to date. PULL DOES NOT DOWNLOAD THE ENTIRE BUILD. It quickly downloads only the data necessary to bring your copy of the repository up to date.
Using git pull in a script is strongly recommended for 100% automation of release downloads. The clone portion is manual, but once the clone is done, you never have to clone the repository again. You only need to use the git pull command after the clone is finished.
Steps
To manually pull the repository in, follow these steps:
1. In Windows Explorer, navigate the the repository directory you cloned to and right-click and choose “Git Bash Here”. A Git Bash terminal screen will open with the branch indicator on the right of your current location. In Linux, open your terminal shell and navigate to the location of your cloned repository.
2.Type in the following command with NOTHING ELSE after it:
<b>time git pull --rebase<b>
3.Press [Enter]
4.If you are not using a netrc file, you will be challenged for your credentials
5.Wait for the pull to complete. A completed pull will return you to the Git Bash prompt in your terminal. Note that the total size of objects is not the same as when you did a clone or when you clone a repository with only one release.
Master Branch
If you have instructed Git to checkout an older release tag, you can still execute the pull command to update your local repository. However, the files in visible space do not change after the pull completes, and only the contents in the hidden .git folder do. The git branch command will tell you which branch\tag you are currently on in the local repository. You need to do git checkout master to switch to the master branch and tip in order to see the updated files that exist at the tip. Otherwise, the updated content goes straight to the .git hidden folder until you checkout the master branch or current release tag later.
Automating
Once the pull is complete, you can execute it again on a daily basis. Git will return “Already up-to-date” if there are no new files to download.
Since the action of pulling new code can be 100% automated, you can configure your scripts to do a git pull on a daily basis.
Do not bombard the system with constant git pull commands, or your account will be disabled! A few times a day is sufficient for automation purposes.
Example Git Pull
One benefit of Qualcomm® Package Manager’s use of git is to be very efficient on the content delivery for updated repositories. When a new release is posted, git will only provide the files necessary to bring your repository up-to-date. It does not send files you already have downloaded.