diff --git a/README.md b/README.md index 00fe8cf..44be4b6 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,8 @@ All commands should work for at least git version 2.13.0. See the [git website]( - [Final Step: Pushing your changed repo history](#final-step-pushing-your-changed-repo-history) - [I need to change the content of a commit which is not my last](#i-need-to-change-the-content-of-a-commit-which-is-not-my-last) - [Staging](#staging) + - [I want to stage all tracked files and leave untracked files](#i-want-to-stage-all-tracked-files-and-leave-untracked-files) + - [To stage part of tracked files](#to-stage-part-of-tracked-files) - [I need to add staged changes to the previous commit](#i-need-to-add-staged-changes-to-the-previous-commit) - [I want to stage part of a new file, but not the whole file](#i-want-to-stage-part-of-a-new-file-but-not-the-whole-file) - [I want to add changes in one file to two different commits](#i-want-to-add-changes-in-one-file-to-two-different-commits) @@ -562,6 +564,24 @@ will do the rest of the work for you. ## Staging + + +### I want to stage all tracked files and leave untracked files + +```sh +$ git add -u +``` + +#### To stage part of tracked files + +```sh +# to stage files with ext .txt +$ git add -u *.txt + +# to stage all files inside directory src +$ git add -u src/ +``` + ### I need to add staged changes to the previous commit @@ -1595,7 +1615,7 @@ $ rm -rf .git/modules/submodulename ### Copy a folder or file from one branch to another ```sh -$ (my-branch)$ git checkout -- +$ git checkout -- ``` ### Restore a deleted file