728x90
git add .
git commit -m "fix: 커밋메세지"
git push origin
혹은 새로운 브랜치라면
git push --set-upstream origin 브랜치명
git add .
git commit -m "fix: 커밋메세지"
git push origin
위와 같이 일련의 명령어를 입력해야 한다.
bash 스크립트 만들어서 한방에 해결해보자
파일명이 bash.sh 이라고 가정한다.
[기존 브랜치에 푸시하는 경우]
sh ./bash.sh "fix: test 커밋입니다."
msg=$1
git add .
git commit -m "$msg"
git push origin
[새로운 브랜치인 경우]
sh ./bash.sh "fix: test 커밋입니다."
branchName=$(git branch --show-current)
msg=$1
git push --set-upstream origin $branchName
git add .
git commit -m "$msg"
git push origin
다음은
master 브랜치에서 작업을 한 뒤에
아래 4가지 일련의 과정을 한번에 처리하는
bash 스크립트를 해보자
1. 작업 내용 임시저장
2. 브랜치 생성
3. 작업 내용 다시 불러오기
4. 작업한 파일 커밋 & 푸시하기
'Git' 카테고리의 다른 글
git - 자주 쓰는 log 명령어 (0) | 2024.09.14 |
---|---|
git - new 브랜치 생성 후 편하게 origin에 푸시하기(--set-upstream 아님) (0) | 2024.09.14 |
Git 명령어 - tag (태그) (0) | 2024.08.25 |
Git 명령어 - git remote 관련 명령어 (0) | 2024.08.25 |
Git 명령어 - 되돌리기 관련 명령어 (0) | 2024.08.25 |