[Goal]

  • Git을 사용하는데 있어 필수적으로 사용되거나 알아야 할 다양한 기능들에 대해서 알아본다.

[Reference Site]


[사용되는 기능 및 명령어]

Image get from: https://support.nesi.org.nz/hc/en-gb/articles/360001508515-Git-Reference-Sheet

# Make first local repository 
$ git init

# To see all branch corresponding this package
$ git branch -a 

# To make another branch corresponding this package
$ git branch <own_name>

# Move to another branch in corresponding this package
$ git checkout <branch_name> 

# Add all changes(modified files) to current branch 
$ git add .

# Add some files to current branch
$ git add README.md

# Register modified files to remote storage
$ git commit -m "Message Content" 

# Save and upload modified files to remote storage
$ git push origin <branch_name>

# See git status
$ git status

# See git history
$ git log

# To go pull another branch in origin root
$ git reset --hard (6~7 words)

# Get remote repository to update
$ git pull

 

[주의 사항]

  • git clone을 하게 되면 특정 version branch가 아닌 main branch가 clone이 된다. 그래서 우리는 특정 branch로 이동하기 위해서 다음과 같이 변경해주어야 한다.
    • Example of "rosbot-stm32-firmware" in "lib" folder
# First download default main 
$ git clone https://github.com/byq77/rosserial-mbed.git

# Then convert to which person want to see
$ git reset --hard 509e7c1

'▷ Studies > G' 카테고리의 다른 글

[Git LFS] File size exceeds GitHub origin upload size  (2) 2024.09.18

+ Recent posts