2016/01/11 Start learning git: View warehouse status and modify files

Source: Internet
Author: User
Tags version control system

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.