Git Quick Guide

    xiaoxiao2021-04-18  49

    #====================Initial================= # config global user(config file is located in ~/.gitconfig) git config --global user.name "username" git config --global user.email "email" # config local user (config file is located in .git/config) git config [--local] user.name "username" git config [--local] user.email "email" git config --list # list current setting # store password git config --global credential.helper store #==============Clone from remote============= # Clone(Only master) git clone $HTTPS # Clone(Specified branch) git clone -b $BRANCH $HTTPS # Use checkout to clone other branches you need git branch -r #see branches on remote git checkout -b $BRANCH origin/$BRANCH # Switch to new branch git checkout $BRANCH # ===============Track & Untrack============== # Track files git add --all git add *.cpp # Untrack files git rm --cached $FILE # By ignore file gedit .git/config # insert at core section excludefiles=.gitignore gedit .gitignore # add files you do not need *.[ao] *~ *.out # =============Update=============== git fetch origin master:tmp git diff tmp git merge tmp # or git pull origin master # =============Roll back=============== git reset --hard HEAD^ git reset --hard HEAD~2 git reflog git reset --hard HEAD@{1} # ===============Tag================= git tag # show all git tag -a v1.01 # add git tag -d v1.01 # delete git push origin [tagname] # upload one tag git push origin --tags # upload all local versions
    转载请注明原文地址: https://ju.6miu.com/read-674851.html

    最新回复(0)