Beginner Guide to GIT CLI
From Metro Studios Knowledgebase
 Cloning Remote Projects
Cloning a remote repository uses the clone command:
git clone ssh://USERNAME@SERVER.TLD:11200/var/www/vhosts/DOMAIN.TLD/httpdocs.git
You can find the specific git clone string you need by going to the domain lookup tool and selecting the domain you wish to clone.
 Modifying Existing Projects
 Pulling Existing Files from the Server
Before you make any changes to a project or website, you should always pull the existing files to minimize the chances of a git conflict. In order to fetch and merge changes you need to run the following command:
git pull origin master
In the event that there is a conflict with the remote repository, you'll see a response that looks something like this:
To ssh://USERNAME@dev1.metro-studios.com:11200/var/www/git/misc/httpdocs.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'ssh://[email protected]:11200/var/www/git/misc/httpdocs.git' To prevent you from losing history, non-fast-forward updates were rejected Merge the remote changes before pushing again. See the 'Note about fast-forwards' section of 'git push --help' for details.
If you see this warning message, either give your favorite developer a shout, or fix the merge conflict by following the instructions on this page.
 Adding New files
When you add new files to a website or project you will need to add those files to the git repository before committing or pushing. To do this you need to run the following command:
git add path-to/filename.ext
If you are adding multiple files in one directory, you can simply run the command and supply just the directory you wish to add:
git add path-to-files/
Finally, you can pass through the *' wild card and add all changed files. To do this you just simply run the following command:
git add .
 Committing Changed Files
When you edit an existing file and just need to commit those changes you should run the commit command (be sure you use the -m argument to supply a commit message):
git commit -m "Commit message goes between these quotes" path-to/filename.ext
Additionally, if you want to commit all changed or added files you can pass the -a argument along with the -m:
git commit -am "Commit message goes here"
Once you've committed all of the files you want to push, you just need to run the push command.
 Pushing Changes to the Server
In order to push changes to the live server, you must run the git push command: