diff --git a/gitcli-basics/README.md b/gitcli-basics/README.md index bfd3854c1fbca31c299ea39af6a2f9d13e28df3a..5d21cacc62944915f87a6ee10d5eb97111f2753b 100644 --- a/gitcli-basics/README.md +++ b/gitcli-basics/README.md @@ -12,6 +12,9 @@ The `git status` [command](https://git-scm.com/docs/git-status) displays informa - If it is related to a remote branch, have any modifications been made on either side ? - What has happend to the files and folders of the local repository ? +#### Important note + 1. By default Git ignores files with a predefined list of suffixes, considering they are generated by some complation process, and should not be included in a Git repository. These files will not show up in the output of `git status`. + On a freshly cloned repository, the output of `git status` looks like:  @@ -20,7 +23,32 @@ The `git log` [command](https://git-scm.com/docs/git-log) details all the operat On the freshly cloned example repository, the output of `git log` looks like: -  +  + + +## Making changes to a local repository + +You can make any changes to a local repository (adding, removing, renaming files and folders, editing files). Git will take note of what has changed and you can always use `git status` to view the changes. + +For example, after editing the contents of the `README.md` file, `git status` will display: + +  + +Notice that Git mentions that the `README.md` and the `imaginary.md` files have been modified *but has not been staged for commit*. The same is true for the newly added `images/bigfoot.jpeg` file. This means that even if you try `git commit` right now, nothing will be commited. + +### Notifying Git which changes have to be included in the next commit. + +Git has to be explicitely made aware of what changes you want to include in the next commit. For files that have been modified or new files, this is done with the `git add` [command](https://git-scm.com/docs/git-add). When `git add` is followed by a file name, this file will be included in the next commit. When `git add` is followed by a folder or directory name, each file it contains will be included in the next commit. + +After using Git add on the modified and new files of the repository, this is what the output of `git status` looks like. + +  + +#### Important notes + 1. Using `git add` on an empty directory has no effects : Git does not manage empty directories. + 1. If you edit a file for which you already did `git add`, you will need to do the `git add` again. + + diff --git a/gitcli-basics/media/status_after_add.png b/gitcli-basics/media/status_after_add.png new file mode 100644 index 0000000000000000000000000000000000000000..8e2538bef1fdea63dbe209f68c621dcef86ecb75 Binary files /dev/null and b/gitcli-basics/media/status_after_add.png differ diff --git a/gitcli-basics/media/status_after_changes.png b/gitcli-basics/media/status_after_changes.png new file mode 100644 index 0000000000000000000000000000000000000000..d9f9fe453d18170c38980a6064560d1be2e95fb7 Binary files /dev/null and b/gitcli-basics/media/status_after_changes.png differ