Git基礎命令

  • Show what’s changed but not yet staged

    展示改變但是沒有提交

    git diff

  • Rename main.txt to file.txt

    把main改名爲file

    git mv main.txt file.txt

  • Initialize a repository

    初始化git庫

    git init

  • Pull data from remote “develop” without merging

    在不合並的情況下從遠程“develop"分支提取數據

    git fetch develop

  • Stage files and commit

    不知道具體含義

    git commit -a

  • Create tracking branch ‘fix2’ based off origin

    在origin的基礎上創建分支fix2

    git checkout --track origin/fix2

  • Create new branch feature

    git branch feature

  • Push develop branch to remote staging master

    推送develop分支到master上

    git push staging develop:master

  • Create branch “feature2” and switch to it

    創建分支,並切換到此分支

    git checkout -b feature2

  • Show last commit on all branches

    所有分支最後一次提交

    git branch -v

  • Force delete branch “fix” that is not yet merged

    強制刪除未合併的分支fix

    git branch -D fix

  • Show branches already merged into current branch

    暫未知功能

    git branch --merged

  • Push local branch “feature1” to origin

    將本地分支f推送到遠程origin

    git push origin feature1

  • Delet remote branch “fix2” from origin

    從origin刪除fix2分支

    git push origin:fix2

  • Push master branch to origin server

    把主分支推送到遠程origin服務商

    git push origin master

  • Show branch not yet merged into current branch

    展示至今沒有合併到現在分支的分支

    git branch --no-merged

  • Delete branch “mybranch”

    刪除分支

    git branch -d mybranch

  • Show current branches

    git branch

  • Switch to branch ‘master’

    git checkout master

git命令練習記錄 如果有不正確的地方請指出,也可以補充我不知道的

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章