First, the configuration
Open git Bash,
" username " " [email protected] "
Second, create the Code warehouse
Create a new folder, under the folder Git Bash, and then enter
Git init
You can create a code warehouse. A hidden folder appears under the current folder. Git.
Third, submit the code
" wrote a readme file "
Where-M is followed by a comment on this submission. Be sure to add and post commits first.
If you want to add all the files under the folder, you can enter git Add. If you want to ignore a portion of a file or folder, you can create a new. Gitignore under the current folder, and then enter what you want to ignore, such as
/bin/project.properties
Iv. Viewing the modified content
After modifying some of the files in the code warehouse, you can enter Git status to view the changes and enter Git diff to see what's changed.
V. View submission Records
git log
Vi. Undo Uncommitted changes (you only need to enter the second command if you haven't added one)
git reset HEAD src/example.javagit checkout src/example.java
Vii. fallback to previous versions
git reset--hard ^head
Head indicates the current version;
^head (or head~0) indicates the last submitted version;
^^ the last committed version of HEAD (or head~1), and so on.
This can also be overridden by the version number (which can be a few of the previous versions, typically 7-bit).
Viii. view all records for all branches
Git reflog
Note: Git log is not able to view the version after reset is deleted, and the above command can.
Android Learning notes (a) Git-related configuration and usage