Using Git
Learn how to use the Git version control system on hosting.com servers.

About Git
Git is installed on all shared and reseller hosting accounts. On VPS or Dedicated Server accounts, you can install it manually or request installation. Git lets you track multiple revisions of files and directories.

Creating a repository

  1. Log in using SSH.

  2. Create a repository:

git init repository

(Replace repository with your desired directory name.)

  1. Change to the new repository:

cd repository
  1. Stage files for commit:

git add .
  1. Commit the files:

git commit

A text editor opens to enter a commit message.

Note
If Git asks for your identity, run:

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

Making changes to a repository

  • After editing files, stage and commit changes:

git add .
git commit
  • Combine add and commit:

git commit -a
  • Include a commit message inline:

git commit -a -m "message"
  • View uncommitted changes:

git status
  • View commit history:

git log

Working with branches

  • Create a new branch:

git branch name
  • List all branches:

git branch
  • Switch to another branch:

git checkout name

Merging changes from another branch

git merge name

(Merges changes from the branch name into the current branch.)

Cloning a repository

  • Clone a repository to a new directory:

git clone /home/username/project /home/username/projectclone
  • Pull changes from the clone back into the original:

cd /home/username/project
git pull /home/username/projectclone master
Note
If you encounter HTTPS certificate errors while cloning, this may be due to jailshell. Request normal shell access via the Hosting Panel.

More information
Official Git documentation: http://git-scm.com/documentation

Hjälpte svaret dig? 0 användare blev hjälpta av detta svar (0 Antal röster)

Powered by WHMCompleteSolution