- 從 branch merge 回 master, 導致 pom.xml conflict, 想 reset pom.xml 因為這不是我要 merge 的內容. (stackoverflow)
git reset pom.xml
git checkout pom.xml
- 想清掉 untrack file
git clean -f
- 想清掉 untrack folder
git clean -f -d
- 有次一個 branch 太久沒 pull 了, 後來不知道誰改了甚麼, 要再 pull 都 conflict 一堆.
反正我也沒有要保留 local 的東西, 同事就教我強制把 local 的檔案 reset 到某個版本
git reset comm_id --hard
- 在 pull 之前就 commit, git status 出現 "Your branch is ahead of 'origin/master' by 25 commits" 的訊息, 用 reset 還原
git reset --hard origin/master
- 要把一個 branch 傳送到另一個 repository
# new remote
git remote add remotename git@git.abc.com:test/test.git
# push branch to remote
git push -u remotename branchname