본문으로 바로가기

[GIT] 자주 사용하는 Git 명령어

category Dev Environment/Git 2020. 3. 14. 15:54
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
git init                                             // git project 생성
git clone ${git_path}                                // local 에 git project 가져오기
git checkout ${branch_name}                          // branch 선택
git checkout -${remote_path/branch_name}           // 원격 branch 선택하기
git branch ${branch_name}                            // branch 생성하기
git branch -${branch_name} ${change_branch_name}   // 브랜치 이름 바꾸기
git branch -${branch_name}                         // 브랜치 삭제하기
git add ${file_path}                                 // 수정한 staging area 에 추가
git commit -"description"                          // 간략한 msg 로 commit
git push ${romote_name} ${branch_name}               // remote 에 commit push
git pull                                             // git 서버에서 최신 코드 받고 merge
git fetch                                            // git 서버에서 최신 코드 받기
git reset -hard HEAD^ or ${commit-id}                // 특정 commit 으로 reset
git reset -soft HEAD^ or ${commit-id}                // 특정 commit 으로 reset, 수정 내역은 유지
git config -global user.name "user_name"             // git 사용자 설정
git config -global user.email "user_email"           // git 사용자 email 설정
git stash / git stash save "description"             // 작업코드 임시저장
git stash pop                                        // 마지막 임시저장 내용 load