Questions tagged [git-add]

git-add - Add file contents to the index

Before each commit in , you need to add file contents to the staging area.

The following will add all the files currently on the stage at the next commit:

$ git add .

This also adds the files recursively under the current working directory. Files previously tracked (i.e. they were in the last commit), still need to be added to the stage.

You can track new files specifically like so (where foo is the filename in this example):

$ git add foo

To add multiple files, separate them with a space like so (bacon and cheese being the other example files):

$ git add foo bacon cheese

References

330 questions
1
vote
1 answer

Some folders are empty while cloning after a git add -A

I created some repository in Git and added repos as submodules. In the submodule repo i added contents.( folders and files).After that i did git add -A git commit -m "message" git push origin master. After that i tried to clone the repo from some…
user1722227
  • 21
  • 1
  • 7
1
vote
0 answers

git add failing because of .DS_STORE file

I removed a .DS_STORE file from my local repo then I ran git add ., and I have this message : fatal: unable to stat '.DS_Store': No such file or directory How can I manage this ?
epsilones
  • 11,279
  • 21
  • 61
  • 85
1
vote
3 answers

How to Undo "git add -A" in uninitialized local empty repository (while keeping the files on my computer)?

I just started learning Git & Ruby on Rails and from the cmd prompt on my Windows 7 machine, I accidentally did a git add -A under my C:\Users\myusername. All my files were added, but are untracked locally on Git. Obviously, I don't want to delete…
1
vote
1 answer

when add a file to staged area, does git save the directory info?

I am curious about git add action, so I do some test. create a index 1. git init 2. mkdir mydir 3. echo "hello" > mydir/hello 4. find .git/objects ==> nothing 5. git add . 6. find .git/objects ==> only find one file ,by cat-file, I am sure it is…
yao
  • 1,993
  • 2
  • 12
  • 10
1
vote
2 answers

Git. Update untracked files

When I use command git add -u . git still doesn't update untracked files. Works only when I specify them by path, git add -- filepath What could it be?
sunprophit
  • 1,639
  • 4
  • 16
  • 39
0
votes
2 answers

Unable to Stage Changes in Git for Specific Files, Getting Consistent Output

I'm currently facing a persistent issue with staging changes using Git. No matter which commands I try, I keep getting the same output when I check git status. The output consistently looks like this: Changes not staged for commit: (use "git add…
sanbinary
  • 81
  • 1
  • 8
0
votes
0 answers

.DS_Store "Changes not staged for commit?"

I'm very new to coding so please be patient On a macOs. I had help from a tutor to move my .ds_store and future .ds_store files into my .gitignore file, (wasn't aware what a .ds_store file even was until I accidentally uploaded it to a repo and had…
0
votes
1 answer

Does git add -A respect .gitignore?

I have several target subdirectories in my project that I do not want to track. So I removed them all with: find . -type d -name 'target' -print0 | xargs -0 git rm --cached -r -- I also added ./*/target/ to my .gitignore file. I then ran git add -A…
brianxk
  • 63
  • 1
  • 6
0
votes
1 answer

How can I `git add` on cloned git repo by SSH?

I can git add just add new file on repo directory. but when I make directory and add new file to this directory, I cannot git add. Note: I ran git clone for clone private repo by ssh public key $ git clone…
TaeUk Noh
  • 96
  • 5
0
votes
1 answer

How to include untracked files in a command like `git commit --dry-run -a`

I'd like to review that Git is going to properly detect files as moved, rather than deleted/added new - but there doesn't seem to be any way to preview the operation - it seems like my only option is git add . --dry-run, which then I can't see the…
Slbox
  • 10,957
  • 15
  • 54
  • 106
0
votes
2 answers

how can i add one of my file in the .gitignore file?

I'm new to coding. I learned about the .gitignore file today, and I succeeded in adding an unwanted file to the .gitignore file but could not add one file on the .gitignore file. Untracked files: (use "git add ..." to include in what will…
calipalm
  • 3
  • 4
0
votes
1 answer

Any way to automate partial checkins, excluding changes checked in elsewhere?

I'm someone who's always constructing checkins of only a portion of the differences in my worktree, so some of git's special features — notably git add -i -p and -e — are a real boon. But as useful and as powerful as add -i -p can be, I find myself…
Steve Summit
  • 45,437
  • 7
  • 70
  • 103
0
votes
1 answer

Commit separately specific files inside untracked new directory in git

I have a new created directory "supplier_directory", in which there are 3 new files. I need to add these files into different commits. Commit N1 : file1 only Commit N2 : file2 and file3 I'm having the following: supplier_directory when…
0
votes
0 answers

Broken repos by applying git clone and add . to a parent folder

This is the 2nd time it happens to me. The first time I thought it was a hard drive problem. I'm trying to back up all my projects, that don't have a Repos in it. Because of my bad practices, I've local projects with repo and local projects without…
user8410236
0
votes
1 answer

git add giving a super long never ending output

So I am kinda new to git and github and wanted to push a project on github. However, when I add files git add . it gives a super long message that does not seem to end warning: LF will be replaced by CRLF in…
Milanor
  • 51
  • 5