GitHub command-line operation (perfected)

GitHub command line

Local repo

  • Set name and email

    git config --global user.name "xxxx"

    git config --global user.email "[email protected]"

  • Creates and initializes a local empty warehouses

    git init <repo_name>

  • View the status of submitted

    git status

  • Scratch pad Add Change

    git add <file_name>

  • Record submit information line

    git commit -m "commit info"

  • Submit records

    git log

  • Ignore specific format file format

    touch .gitignore && vim .gitigonre

    *.out *.py # in .gitignore

    Original format created with git rm --cached <file_name> ignore  ignore common project file

  • Rollback

    git reset (--mixed --hard --soft ) HEAD~(可换) #自己查询参数

    git commit --amend 轻微修改,不进行新的提交

Remote repo

  • View branch

    git branch

  • Creating a branch

    git branch <branch_name

  • Switching to the branch

    git checkout <branch_name>

  • Creating and switch

    git checkout -b <branch_name>

  • Branches merge

  • Branch sync

  • Delete and rename branch

  • tag management

Guess you like

Origin www.cnblogs.com/hanxinle/p/11605676.html