Git_test
기본적인 git 사용방법은 튜토리얼[1]을 통해서 공부하였습니다.
git basic 명령어
- git config/init/clone
git config –-global user.name “[name]”
git init [repository name]
git clone [url] - git add/commit [6]
git add [file],git add *,git add .
git commit -m “[ Type in the commit message]",git commit -a - git reset/revert [7]
git reset --soft HEAD~,git reset [--mixed],git --hard HEAD~
git reset file.txt==git reset [--mixed] HEAD file.txt
git revert HEAD~3,git revert -n HEAD~5 HEAD~3 - git branch/checkout
git branch <branchname>,git branch release_1.0 master
git branch -D <branchname>,git branch -m <branch1> <branch2>
git checkout <branch>,git checkout -b <branch> -t <base_branch> - git remote/push/pull/fetch
git remote -v,git remote add upstream https~~~
git push origin,git push origin master:master,git push --set-upstream origin develop
git fetch origin,git fetch origin master:master
git pull origin,git fetch origin master:master - git merge/rebase/cherry-pick [8]
git merge <branch>,git merge --squash <branch>
git rebase <branch>,git rebase -i <branch>
git rebase <base_branch> <topic_branc>,git rebase --onto master server client
git cherry-pick <commit>
협업 방법
git을 활용한 협업 방법(workflow)에는 Git flow, GitHub flow, GitLab flow가 있습니다.
나온 순서로는 Git flow > GitHub flow > GitLab flow, 복잡도는 Git flow > GitLab flow > GitHub flow 순입니다.\
- Fork: upstream -> origin
- clone: origin -> local
- issue 생성: in upstream
- branch 생성: in local
git checkout -b develop -t origin/developgit checkout -b feature-add_world -t develop
- git commit: git commit -ma “” or 5.1 git add 5.2 git commit -m
- git push origin
- pull request(PR) (with issue 번호) origin => upstream
- code review 8.1 pull request 후, 해당 branch에 추가 commit/push되면, PR이 자동 update됨
- merge: in upstream
- update local from upstream
- git checkout master
- git fetch upstream
- git rebase upstream/master
- git push -f origin master