Skip to content

Commit bce2f0d

Browse files
karthik-duraiRichardLitt
authored andcommitted
Note/git add u (k88hudson#287)
* add note about 'git add -u ' * run doctoc * add note about copying folder * add space b/w -- and folder name also mention, this can be done for files * add 'file' in the title * add node on using pathspec * run doctoc * fix small errors * run doctoc * remove 'my-branch' text
1 parent f0b4337 commit bce2f0d

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

README.md

+21-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ All commands should work for at least git version 2.13.0. See the [git website](
4848
- [Final Step: Pushing your changed repo history](#final-step-pushing-your-changed-repo-history)
4949
- [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)
5050
- [Staging](#staging)
51+
- [I want to stage all tracked files and leave untracked files](#i-want-to-stage-all-tracked-files-and-leave-untracked-files)
52+
- [To stage part of tracked files](#to-stage-part-of-tracked-files)
5153
- [I need to add staged changes to the previous commit](#i-need-to-add-staged-changes-to-the-previous-commit)
5254
- [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)
5355
- [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.
562564

563565
## Staging
564566

567+
<a href="#i-want-to-stage-all-tracked-files-and-leave-untracked-files"></a>
568+
569+
### I want to stage all tracked files and leave untracked files
570+
571+
```sh
572+
$ git add -u
573+
```
574+
575+
#### To stage part of tracked files
576+
577+
```sh
578+
# to stage files with ext .txt
579+
$ git add -u *.txt
580+
581+
# to stage all files inside directory src
582+
$ git add -u src/
583+
```
584+
565585
<a href="#i-need-to-add-staged-changes-to-the-previous-commit"></a>
566586
### I need to add staged changes to the previous commit
567587

@@ -1595,7 +1615,7 @@ $ rm -rf .git/modules/submodulename
15951615
### Copy a folder or file from one branch to another
15961616
15971617
```sh
1598-
$ (my-branch)$ git checkout <branch-you-want-the-directory-from> -- <folder-name or file-name>
1618+
$ git checkout <branch-you-want-the-directory-from> -- <folder-name or file-name>
15991619
```
16001620
16011621
### Restore a deleted file

0 commit comments

Comments
 (0)