Some useful links:
https://www.git-scm.com/
http://nvie.com/posts/a-successful-git-branching-model/
git development mode:
It is recommended to have at least one master and develop branch. Master only makes version maintenance work, develop for development. The development is complete and the test is passed and merged into master.
Common scenarios:
If you push the commit to remote without being pushed by someone else, you can use
git reset--hard <commit-hash>
Git push-f origin Master (assuming that both local and remote are operating on master)
To revoke the commit that was committed before.
But if someone else synchronizes your push, you can use revert locally to restore the commit you committed, then generate a new commit and push it to the far end.
Note: If the commit of remote is not irrevocable, you can choose to continue developing and pushing the updated commit in a way similar to fixing the bug.
- Remove unwanted branches from remote
Git push origin: <delete branch>
Main commands: git revert and git reset
Git revert is to generate a new commit to undo a commit, the commit will be preserved, and the revert operation itself will be recorded.
Git reset is going back to a commit, commit and previous commit will be retained, but the subsequent changes will be returned to staging area (as appropriate). The operation itself is not logged.
--soft only commit is rolled back, index and content unchanged
--mixed commit and index are rolled back, content is unchanged
--hard commit and index are rolled back, content is reset and content cannot be retrieved
Possible problems:
- Git status/add Chinese garbled
Scene:
When you use git add to add a file or use Git status to view the status, the Chinese file name will display garbled characters such as 274\232\350\256\256\346\200\273\347\273\223.png
Solution:
git config--global core.quotepath false
Reference Link: http://zengrong.net/post/1249.htm
- Adding a new SSH key to the Ssh-agent
Reference Link: https://help.github.com/articles/adding-a-new-ssh-key-to-the-ssh-agent
GIT-related knowledge