1. Use git status to view the status of the repository
$ git status
On Branch Master
Nothing-to-commit, working directory clean
Git tells us that there are no changes that need to be committed at this moment, and that the working directory is clean (working directory cleanly).
2. Now go to modify the contents of Readme.txt
The original content is:
Git is a version control system.
Git is free software.
After modification:
Git is distributed a version control system.
Git is free software.
3.git status querying the state of the repository
$ git status
On Branch Master
Changes not staged for commit:
(use "git add <file> ..." To update what would be committed)
(use "Git checkout--<file> ..." to discard changes in working directory)
Modified:readme.txt
No changes added to commit (use "git add" and/or "Git Commit-a")
[Email protected] Mingw64/e/learngit (Master)
See prompt Readme.txt is modified but not ready to commit changes
4.git diff Readme.txt View the differences before and after Readme.txt changes
[Email protected] Mingw64/e/learngit (Master)
$ git diff readme.txt
Diff--git A/readme.txt B/readme.txt
Index D8036C1: 487c372 100644
---a/readme.txt
+ + B/readme.txt
@@ -1,2 +1,2 @@
-git is a version control system.
+git is distributed a version control system.
Git is free software.
\ No newline at end of file
[Email protected] Mingw64/e/learngit (Master)
$
See what's new
5. Git add, git commit commit changes
git add readme.txt
git status
[Email protected] Mingw64/e/learngit (Master)
$ git status
On Branch Master
Changes to be committed:
(use "Git reset HEAD <file> ..." to Unstage)
Modified:readme.txt
[Email protected] Mingw64/e/learngit (Master)
Git commit-m "Add distributed"
[Email protected] Mingw64/e/learngit (Master)
$ git commit-m "ADD distributed"
[Master 5e0e7b7] ADD distributed
1 file changed, 1 insertion (+), 1 deletion (-)
[Email protected] Mingw64/e/learngit (Master)
$
6.git Status View
[Email protected] Mingw64/e/learngit (Master)
$ git status
On Branch Master
Nothing-to-commit, working directory clean
[Email protected] Mingw64/e/learngit (Master)
$
2016/01/11 Start learning git: View warehouse status and modify files