Aller au contenu

Using Git

Ce contenu n’est pas encore disponible dans votre langue.

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

About Git
Git is installed on all shared 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.

  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"
  • 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
  • Create a new branch:
git branch name
  • List all branches:
git branch
  • Switch to another branch:
git checkout name
git merge name

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

  • 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

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

Cette page vous a-t-elle aidé ?