Git HowTo

From TaejoonLab
Jump to: navigation, search

From pre-existing repo

If you join a project with pre-existing git repository,

  1. Go to the local directory you want to use for git.
  2. Check out the repo using 'git clone <repo address>'. (you may see the new directory with project name)

From scratch

If you need to make a project repository,

  1. Go to the local directory you want to use for git.
  2. Make a directory ('mkdir <dir name>')
  3. Move into the directory ('cd <dir name>')
  4. Initialize git repo by 'git init'.
  5. Make a file for project, then add it by 'git add <filename>'.
  6. Commit your file with 'git commit -m "<my comment for this commit>"'.
  7. Upload your file with 'git push'.

Download up-to-date files from a repo

  1. Move to a local git repo.
  2. Use 'git pull' to sync local file with a repo. If there is an error, check the message and resolve the conflict.

Before pushing any of your changes, run 'git pull' first to sync your local repo with remote one.

Routine job

  1. Use 'git add' when you introduce new file into repo.
  2. After doing your work, apply the change using 'git commit -m "<my comment>"'.
  3. Upload your works to a repo using 'git push'.

Reference