Write-Up 好記性不如爛筆記

Git備忘錄

Git-分支-利用分支進行開發的工作流程

branch

可以先在repo上面開branch 當你clone下來以後,要在本機端再開一個相同名稱的branch ? 切到該branch底下 就可以 git push origin branchName 就可以推到該branch底下

可以不用先開branch 在repo上 可以直接先切一條branch出來 在底下開發 然後commit 在 git push origin branchName
Github repo底下就出現了你剛剛推的branch

delete Github repo branch git push origin –delete [branchname]

merge

如果要merge到master上 先切到master上,git merge branchName 這樣你master底下就會出現 被merge 那條branch的東西 如果你要推上github repo,再 git push origin master就好了

Delete file in Github repo

git rm file1.txt
git commit -m "remove file1.txt"

And push to change remote repo

git push origin branch_name

But if you wanto to remove the file only from the Git repo and not remove it from fileSystem use

git rm --cached file1.txt
git commit -m "remove file1.txt"
git push origin branch_name