Changes between Version 5 and Version 6 of WorkingWithGit


Ignore:
Timestamp:
Aug 20, 2016, 8:04:39 PM (8 years ago)
Author:
neverpanic (Clemens Lang)
Comment:

Reformat so that the commands in whole-line blocks show the sequence you should be running for a commit.

Legend:

Unmodified
Added
Removed
Modified
  • WorkingWithGit

    v5 v6  
    5353
    5454=== Committing changes in your working copy ===
    55 A fundamental difference between Subversion and Git working copies is that `svn commit` by default commits all changes in your working copy, but `git commit` by default commits none. Git uses a staging area called "index" that allows you to mark changes for inclusion in the next commit. To add changes to the next commit, use `git add <filename>`. `git status` gives you an overview of the current index and your working copy. Additionally, it lists the commands to revert local uncommitted modifications (`git checkout -- <filename>`) and to remove files from the next commit, but preserve the modifications in your working copy (`git reset HEAD <filename>`).
     55A fundamental difference between Subversion and Git working copies is that `svn commit` by default commits all changes in your working copy, but `git commit` by default commits none. Git uses a staging area called "index" that allows you to mark changes for inclusion in the next commit. To add changes to the next commit, use
     56{{{
     57git add <filename>...
     58}}}
    5659
    57 Once you have chosen which files to include in your next commit using `git add`, it is a good practice to review this list using `git status` and show the diff to be committed using `git diff --cached`. When you are satisfied with your changes, run `git commit`, which prompts you for the commit message. See the [#commitmessages section on commit messages in git] for more information on git conventions and expectations in commit messages.
     60`git status` gives you an overview of the current index and your working copy. Additionally, it lists the commands to revert local uncommitted modifications (`git checkout -- <filename>`) and to remove files from the next commit, but preserve the modifications in your working copy (`git reset HEAD <filename>`).
     61
     62Once you have chosen which files to include in your next commit using `git add`, it is a good practice to review this list using
     63{{{
     64git status
     65}}}
     66and show the diff to be committed using
     67{{{
     68git diff --cached
     69}}}
     70If you are not satisfied with your changes, you can keep changing your files. Note that you will have to add any new modifications to the index using `git add` again. Once you are satisfied with your change run
     71{{{
     72git commit
     73}}}
     74which prompts you for the commit message. See the [#commitmessages section on commit messages in git] for more information on git conventions and expectations in commit messages.
    5875
    5976