git common commands and commit

Commands commonly used by git:
1. git init — Create a new code base in the current directory. 
2. git config user.name = "" git config user.email = "" — Set the information when the code is submitted. 
3. git clone requires a clone remote address – clone the project from the server side to the local 
4. git status — view the file modification status. 
5. The path of the git diff file-check the difference between this file and the code that was last modified. 
6. git diff-cached file path-check the difference between the local cache and the last commit. 
7. git checkout -b branch name-create a new temporary branch. 
8. git checkout branch name-switch branch. 
9. git branch — View all branches. 
10. git branch –D temp—force to delete a branch 
11. git pull—update the server code to the local. 
12. git add file path-submit the file to the temporary area. 
13. git add –A —Submit all files that need to be added to the buffer. 
14. git commit –m 'Commit description'—commit the buffer file to the local repository. The submission instructions should be as clear and concise as possible. 
15. git push origin master — Push the code that has been submitted to the local warehouse to the remote server. 
16. git log — Display the submitted log. 
17. git show [commit Id] — Display the metadata and content changes of a certain commit. 
18. git show [commit Id] –-stat —-display the name of the submitted file 
19. git checkout —restore all files in the staging area. 
20. git reset [file / commit ID] – reset the specified file in the temporary storage area. Used to undo git commit 
21, git reset –hard [commit Id] —Return the local version to the version before the commit. This operation will undo all the newly written code. 
22. git cherry-pick temp —-Merge the temporary branch to the current branch. 
23. git commit –amend —Modify the contents of the last commit description and merge commits at the same time. Has no effect on Push. 
24. git rm <Delete file path in the local warehouse (provided that it has been submitted to the remote warehouse)> git commit -m “delete file” is executed in two steps, you can delete the file corresponding to the remote warehouse

Submission steps:
1. First, after you have prepared the basic environment through git init git clone, you want to submit your code to the remote server after writing it.
2. git status Check which files are changed
3. Respectively change the file path of git diff to see if there are any spaces or the like. Check the format and change the specific code
4. git add After confirming that there is no error, add the file path that needs to be submitted. You can also add the changes. All you need to submit is git add.
5. git pull
6. git commit -m "Commit note" Remember to commit before commit git pull
7, git push origin master

Published 23 original articles · won praise 2 · Views 5254

Guess you like

Origin blog.csdn.net/bianlitongcn/article/details/93875862
Recommended