Git 筆記


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

沒有留言:

張貼留言

別名演算法 Alias Method

 題目 每個伺服器支援不同的 TPM (transaction per minute) 當 request 來的時候, 系統需要馬上根據 TPM 的能力隨機找到一個適合的 server. 雖然稱為 "隨機", 但還是需要有 TPM 作為權重. 解法 別名演算法...