Advanced Git
git init
To create a new repo, you’ll use the git init command. git init is a one-time command you use during the initial setup of a new repo. .Executing this command will create a new .git subdirectory in your current working directory. This will also create a new master branch. 1
Example:
git init
git remote
The git remote command lets you create, view, and delete connections to other repositories. Remote connections are more like bookmarks rather than direct links into other repositories. Instead of providing real-time access to another repository, they serve as convenient names that can be used to reference a not-so-convenient URL.1
Example:
git remote add origin https://code.vt.edu/s4-hosting-sites/mysite.git
Git Pull:
The git pull command is used to fetch and download content from a remote repository and immediately update the local repository to match that content. Merging remote upstream changes into your local repository is a common task in Git-based collaboration work flows. The git pull command is actually a combination of two other commands, git fetch followed by git merge. In the first stage of operation git pull will execute a git fetch scoped to the local branch that HEAD is pointed at. Once the content is downloaded, git pull will enter a merge workflow. A new merge commit will be-created and HEAD updated to point at the new commit.1
Example:
git pull origin master
- Git Commands: www.atlassian.com/git
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.