본문 바로가기
Tools for Dev

Simple GIT Usage

by leanu 2008. 11. 24.
<Notice>
Modification or re-submission the post with this document is allowd after you let me know about it. Questions or suggestion is welcome. You can contact me at dualistmage@nate.com 

Simple GIT Usage

2008-11-24

Dohyun Yun

 

1.    Get the latest repository from server

$ git pull                                  OR                                  $ git fetch
                                                                                       $ git merge origin


p.s pull is the operation of fetch and merge. But pull merge new contents directly to your repository. When some crash occurs while merging, git could not be recovered. Fetch gets new files to the origin branch which is separated to your master branch. I recommend using fetch and merging.

2.    Do your own work. If you want to remove or move the files or directories which are registered to the git, you must use “git rm” and “git mv” command. If you use “rm” or “mv” instead of those, they are not really removed or moved from repository.

$ git rm [filename]                  OR                                  $ git rm –r [directoryName]
$ git mv [filename]                 OR                                  $ git mv [directoryName]

3.    Get the change list and look at the lists which is in the “Changed but not updated” and “Untracked files”.

$ git status


4.    Add some files recursively. If you want to add whole directory, you can use directory name instead of filename. Do not use “ git add .” if you don’t know exactly all the changed files.  It will add all the changed files of your repository. Recommend to add each file what you work on respectively.

$ git add [filename]                OR                                  $ git add [directoryName]

5.    Commit recent work to register to the repository. Do not use –a option. It commits all the changed files by force.

$ git commit –m “Message What you want to tell”

6.    Push commit to the git. If you reject to use push command, please use 1. Command (pull or fetch & merge) to update your repository.

$ git push

 


'Tools for Dev' 카테고리의 다른 글

boost::thread  (2) 2008.12.22
Excel 에서 유용한 팁  (0) 2008.12.18
GIT - Fast Version Control System  (9) 2008.11.13
boost::shared_ptr  (0) 2008.10.08
boost::asio 를 이용한 asyncronous communication 클래스  (0) 2008.10.07

댓글