fatal: The upstream branch of your current branch does not match
the name of your current branch. To push to the upstream branch
on the remote, use
git push origin HEAD:develop
To push to the branch of the same name on the remote, use
git push origin HEAD
To choose either option permanently, see push.default in 'git help config'.
To avoid automatically configuring upstream branches when their name
doesn't match the local branch, see option 'simple' of branch.autoSetupMerge
in 'git help config'.
μ΄λ κ² λ¬λ€λ©΄, μμ λμμλ μ½λ ( git push origin HEADβ¦ ) λ₯Ό μ¬μ©νμ§ λ§κ³ , git push --set-upstream origin λΈλμΉλͺ
μ μ¬μ©νλ€. μμ μ²λΌ νλ©΄ μ°λ¦¬κ° μ€μ ν default λ‘ λ°λ‘ νΈμ¬κ° λμ΄λ²λ¦°λ€β¦git log λ₯Ό ν΅νμ¬, λμκ°κ³ μΆμ μμ μ commit id λ₯Ό νμΈνμ 볡μ¬νλ€.
μμ μ λλλ¦°λ€.
git reset --hard [볡μ¬ν_컀λ°_id]
hard λͺ λ Ήμ΄λ₯Ό ν΅νμ¬ λμκ°κ³ μΆμ μμ μ commit μ΄νλ₯Ό λͺ¨λ μ§μ°κ²νλ λͺ λ Ήμ΄μ΄λ€.
μ격 μ μ₯μμ μμ λλ¦°κ²μ λ°μνλ€.
git push origin [λΈλμΉλͺ
]
βΌοΈΒ νΉμ μμ λͺ
λ Ήμ΄κ° λ¨Ήμ§ μλλ€λ©΄, git push -f oirign [λΈλμΉλͺ
]
μ μ¬μ©νλ€. κ·Έλ¬λ -f λ κ°μ νλ μμ±μ΄κΈ° λλ¬Έμ μμ£Όμμ£Ό μ‘°μ¬ν μ¬μ©νλ€.
push ν μ»€λ° λ©μμ§ μ€ λ³κ²½νκ³ μΆμ 컀λ°μ νμΈνλ€.
git rebase HEAD~N -i (N μ μ΅κ·ΌμμλΆν° λͺλ²μ§ΈμΈμ§λ₯Ό μΈμλ €μ Nμ μ§μ΄λ£λλ€. )
μλν°μμ pickμ rewordλ‘ λ³κ²½νλ€.
iλ‘ μ
λ ₯λͺ¨λμ λ€μ΄κ° ν 맨 μμ 'pick' -> 'reword' λ³κ²½ ν, esc -> :wq! -> enter
Commit Message μμ
iλ‘ μ
λ ₯λͺ¨λμ λ€μ΄κ° κΌΌκΌΌν νμΈνκ³ μμ ν λ€, 3λ²μμμ²λΌ esc -> :wq! -> enterλ‘ λΉ μ Έλμ¨λ€.
νΈμ ( μμ μ λΈλμΉλ₯Ό μνμΈνμ¬ push νλ€. )
git push origin [νΌμ³_λΈλμΉλͺ
]
μ΄ μλλ€λ©΄, git push -f origin [νΌμ³_λΈλμΉλͺ
]
! κ·Έλ°λ° μ΄κ²λ μλλ€λ©΄, λΈλμΉκ° 보νΈλ°κ³ μμν
λ μ΄λ₯Ό ν΄μ ν΄μ€λ€. ( μ νλ¨νμ¬ νλ€. )
λ‘컬 λΈλμΉ μ΄λ¦ λ³κ²½νκΈ°
git branch -m [OLD_BRANCH] [NEW_BRANCH]
pushκΉμ§ νμκ²½μ°, μ격 λΈλμΉ μ΄λ¦ λ³κ²½νκΈ° ( μ격 μ μ₯μμ μ΄λ―Έ push λ₯Ό νλ€λ©΄, μ격λ λ°κΎΈμ΄ μ€μΌνλ€. )
git push origin :old_branch new_branch
μ λ° μ μ μ°¨λ¦¬κ³ Gitμ μ¬μ©νμ!!!! μμλμ΄ λ무λλ€β¦