2020年2月21日 星期五

Git: work flow of how a feature added to a branch

A workflow of how to add a feature in remote repository ?

full graph




STEP 0: PULL REMOTE TO LOCAL


STEP 1: NEW FEATURE BRANCH FROM LOCAL


STEP 2: EDIT YOUR FEATURE BRANCH (ADD, COMMIT)


STEP 3: LOCAL PULL REMOTE


STEP 4: FEATURE MERGE TO LOCAL, ALSO FIX CONFLICT


STEP 5: LOCAL SQUASH MERGE TO ONE COMMIT


STEP 6: PUSH COMMIT TO REMOTE



NOTE:
1. Difference between  fetch and pull

2. how to check commit history
git log --oneline

3. reset commit(s) from HEAD
git reset HEAD~<numberOfCommit>

4. change last git commit message
git commit --amend -m "reset message
>second line
>third line
"

reference:
https://backlog.com/git-tutorial/tw/stepup/stepup3_1.html
https://gitbook.tw/chapters/using-git/amend-commit1.html