GitHub Command

Clone

Registration of existing directories

$ cd [YourDirectory]
$ git init
$ git add .
$ git commit -m 'First commit'
$ git remote add origin https://github.com/gw-vis/[Repository].git
$ git pull origin master
$ git checkout README.md -ours 
$ git add .
$ git commit -m 'Add .gitignore and LICENSE'
$ git push origin master

GitHub Clone

$ git clone https://github.com/gw-vis/[Repository].git

Operation

The following are the operations of the cloned repository

Branch List

$ git branch
Ex:
* dev-prequa
  master

$ git branch -a

Ex:
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/dev-prequa
  remotes/origin/master

Branch Change

$ git checkout [BranchName]

Ex: 
  $ git check out dev-prequa
  Switched to branch 'dev-prequa'

Create New Branch

$ git branch [NewBranchName]

Git Add

$ git add [Filename]

Ex. 
 - Add to single file.
  $ git add [filename] 

 - Add to all current directory files.
   $ git add .

Git Add Cancel

$ git reset [Filename]

Check git status (git add list)

$ git status

Ex.
On branch dev-prequa
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        modified:   k1/guardian/VIS_PRM.py
        modified:   k1/guardian/VIS_SRM.py

Commit

git commit -m “(Please change to commit comment)”
Or
git commit
  Editor opens.

Push

$ git push origin [Branch]

Ex.
$ git push origin master
$ git push origin dev-prequa 

Git Pull

$ git pull origin [Branch]

Ex.
$ git pull origin master

Check remote repository

git remote -v
Ex.
origin  https://github.com/gw-vis/userapps.git (fetch)
origin  https://github.com/gw-vis/userapps.git (push)

KAGRA/Subgroups/VIS/OpsManual/Git (last edited 2020-10-30 09:40:22 by satoru.ikeda)