Set or view the user name and mailbox

  • Git config — global-l
  • Modify global username and mailbox:
  1. Git config –global user.name git config –global user.name
  2. Git config –global user.email
  • Git config — local-l
  • Modify local user names and email addresses:
  1. Git config –local user.name git config –local user.name
  2. Git config –local user.email

Clearing a User Name

git config --global credential.helper wincred
git credential-manager uninstall
Copy the code

Store user names and passwords

Git config --global credential.helper store git config --global credential.helper storeCopy the code

The fallback version

reset

  • Git reset –hard HEAD^ (HEAD^^ previous version, and so on)
  • After reset, the previous version is not visible. To retrieve it, run the following command: git reflog

Reference: www.liaoxuefeng.com/wiki/896043…

Git reset –hard 1a2552b

The remote library has done a fallback commit
  • Commit after rollback: Git push (error if version is older than remote library)
  • Strong commit after rollback: git push -f

revert

Git revert is used to “reverse” a version to undo changes made to that version. For example, we commit three releases (version 1, version 2, and version 3) and suddenly discover that version 2 doesn’t work (e.g. Git revert () ¶ If you want to undo version 2 without having to undo version 3, you can use git revert to reverse version 2 and create a new version 4 that retains version 3 and undoes version 2. Blog.csdn.net/yxlshk/arti…).

  • Git revert -n version number

Failed to upload a large file. Procedure

Remote: error: File android/java_pid81583.hprof is 536.13 MB; This GitHub's file size limit of 100.00 MB exceeds GitHub

Change method: Delete the large file android/ javA_pid81583. hprof
git filter-branch --force --index-filter "git rm --cached --ignore-unmatch android/java_pid81583.hprof" --prune-empty --tag-name-filter cat -- --all // You can modify the log after deleting. Git commit --amend // You can commit git push again after deletingCopy the code

Delete the branch

  • Git branch -d branch name
  • Git push origin –delete the branch name