A git config related settings
Set up user identities
git config--global user.name "Wxa"
git config--global user.email "[Email protected]"
Set the remote user identity storage method
git config--global credential.helper store//Remember
git config--global credential.helper cache//Caching
git config credential.helper ' cache--timeout=3600 '//Set cache time unit s
Set Push mode matching
git config--global push.default matching//push with the same name
git config--global push.default simple//Current branch push
PS: When a commit is modified to a remote branch, the pull update is used first to prevent the commit error.
Ignore trace files. gitignore
1 indicates the directory by/to, only the directory itself, does not contain its children
2 supports wildcard: * 0 or more characters? single character [] A matching list of single characters;
3!k opening does not ignore (trace) the file or directory to which it is matched
Attention:
1 xxx/* represents all files beginning with xxx/, not all items in the XXX directory. First row priority is greater than last row
2 immediate effect, no need to submit
3 invalid for added
=================================== Common Commands ==================================
git add filename ...//Add File to Staging area
git rm filename ...//delete files from Staging area
git commit [filename]//Submit Staging Area file contents to local library
git clone URL ...//Clone remote Library
git remote add URL ...//Add a distant library on a library base
git push repos_name branch_name//local library file upload to remote library----Create an association to avoid the total fill in the Library name and branch name-git push:branch delete the remote branch git Push:refs/tags/nam e Delete remote Tag
git diff filename//compare library file
git reset--hard commit_id//fallback to previous version head^ last version head^^ version head~n on N versions
git reflog//view version command history
git log//view commit command history
git reset HEAD file ...//Remove index from staging area
Git checkout-file ...//undo Change Precedence Compare staging area and local, if no staging area, then compare library with local
Ssh-keygen-t rsa-c "[email protected]"//Generate SSH Key
Git checkout-b b_name ...//create and switch branches equivalent to git branch b_name git checkout b_name
GIT branch b_name//Create branch PS: Create branch clone from current branch
git checkout b_name//Toggle Branch
Git branch//view Current Branch branch operation use this command plus option (-D Delete-D to delete an unincorporated branch) checkout just toggle (-B does not exist will be created)
git merge b_name//merge current branch with specified branch--no-ff-m "commit_msg" commit record for this merge
git--graph--pretty=oneline--abbrev-commit//View branch Merge situation
git stash//Hide work site
git stash pop//recover hide and delete equivalent git stash apply git stash drop
git stash list//view hidden lists git stash apply [email protected]{0} restore specified hidden
git tag <name> [commit_id]//Create label-a specify label name-M label Description-S label Signature-D Delete label
Git push origin tagname//push tag Git push origin--tags push all non-push tags
git config--global color.ui true//show command color
git config--global alias.unstage ' reset HEAD '//config alias. git/config configuration file Location
Common git commands