Collaborative Tool

[Git] 자주 쓰는 git bash 명령어와 순서

JJoajjoa 2023. 9. 6. 09:57

 

 

 

 

 

git clone URL

>> 현재 있는 곳에 깃을 복사해옴

 

ll

>> 현재 있는 곳의 파일 목록을 보여줌

 

cd 프로젝트명/

>> 프로젝트 파일로 change directory

 

git branch -a

>> 모든 브랜치의 목록을 보여줌

>> 맨 위에 * 은 현재 본인이 어디에 있는지 알려주는거임

 

플랜티-백의 디폴트 브랜치를 dev로 설정해놨었음

 

 

git checkout -t origin/store

>> store 브랜치로 이동하며서 로컬에 땡겨옴

 

 

------------------------------------------------------------

만약에 이런게 뜬다면

 

Note: switching to 'origin/store'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

 

git status

>> 현재 상황을 알려줌

 

On branch dev
Your branch is up to date with 'origin/dev'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   settings.gradle

no changes added to commit (use "git add" and/or "git commit -a")

:

On branch store
Your branch is up to date with 'origin/store'.

nothing to commit, working tree clean

 

 

git add .

>> 변경 사항을 스테이지로 올려줌

 

git push

>> 밀어넣으~


git pull

>> 집어넣으~

 

 

------------------------------------------------------------

 

git branch -vv

>> 현재 브랜치와 그 브랜치가 어디서 왔는지 알려줌

$ git branch -vv
  dev   a8cc830 [origin/dev] Setting 변경
* store 99f761b [origin/store] Feat: 스토어 comments C, D 구현

 

 

댓글수0