개요
- 참고 : https://stackoverflow.com/questions/948354/default-behavior-of-git-push-without-a-branch-specified
git push origin <현재브랜치명>
이거 되게 귀찮았는데, 그냥 git push
하면 되도록 설정할 수 있다.git config 파일 수정
프로젝트 경로/.git/config
파일을 수정해도 되는데, 커맨드로 설정하는게 더 편하다.단순히
push
만 입력했을 때 어떻게 동작할 것인지 push.default
를 통해 설정할 수 있다.# push.default를 current로 변경한다. $ git config push.default current # 현재 프로젝트에만 적용 $ git config --global push.default current # 전체 깃에 적용 $ git push # 이제 git push origin <현재브랜치명> 했던 것과 동일하게 동작함.

.git/config
파일에 반영되었다.햣
git push
만 했는데, 현재 브랜치명으로 잘 푸시된다.push.default 설정 가능한 값 목록
nothing
: do not push anything
matching
: (default before Git 2.0) push all matching branches
- All branches having the same name in both ends are considered to be matching.
upstream
: push the current branch to its upstream branch (tracking
is a deprecated synonym for upstream)
current
: push the current branch to a branch of the same name
simple
: (new in Git 1.7.11, default since Git 2.0) like upstream, but refuses to push if the upstream branch’s name is different from the local one
- This is the safest option and is well-suited for beginners.