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
0
votes
2 answers

How do I use the update command in git add -i?

In interactive, the update command just lists the commands again: $ git add -i staged unstaged path 1: +0/-3 nothing .bowerrc 2: +4/-1 nothing .meteor/packages *** Commands *** 1: status 2: update 3:…
Loren
  • 13,903
  • 8
  • 48
  • 79
0
votes
1 answer

.gitignore_global ignored wrong dir and won't allow it to be tracked after removal

I accidentally added Laravel's app/storage dir to .gitignore_global. This caused problems of course, so I removed it from .gitignore_global. Now no matter what I can't get any project to track app/storage or any of its subdirectories. I've checked…
eComEvo
  • 11,669
  • 26
  • 89
  • 145
0
votes
1 answer

Git Command for adding (not committing) all new files in one shot

We are using Git as a revision control system for our Rails project. Now, I have a bunch of untracked files in my application directory and I would like to add all those untracked files in one shot to the Git index. I referred to the Git…
Rajesh Omanakuttan
  • 6,788
  • 7
  • 47
  • 85
0
votes
0 answers

git add: new vs modified vs deleted

I've been trying to get to grips with 'git add', particularly in relation to how it behaves for new vs modified vs deleted files. I've looked at various guides and tutorials out on the web, but a lot of what's out there seems to be outdated now,…
drmrbrewer
  • 11,491
  • 21
  • 85
  • 181
0
votes
1 answer

How to git rm all deleted files from repo, excluding others

I have used this post Removing multiple files from a Git repo that have already been deleted from disk to figure out how to remove multiple files with git rm at once. Now, I'd like to do this, excluding one directory. I tried this: git rm $(git…
user1015214
  • 2,733
  • 10
  • 36
  • 66
0
votes
1 answer

custom apache ant task git-add (jgit) is not working

I wrote custom ant task which uses jgit. It should take local repository address together with directory address and add all files in the directory to index. It builds successfully but unfortunately it doesn't work. I'm totally new to that, so I…
JulioBordeaux
  • 494
  • 1
  • 7
  • 23
0
votes
1 answer

How to Git commit a second empty file and not delete the first non-empty file?

Using Git, version 1.9.3, on Fedora, version 20, I repeatedly run into the problem that I cannot commit an empty bar file without making Git think that I deleted the previously versioned, non-empty foo file. Both files happen to live in the same…
Tim Friske
  • 2,012
  • 1
  • 18
  • 28
0
votes
2 answers

Error with adding all files with git

I have tried to use git add -A to add all of my files to commit in the past, but now, it does not work anymore. When I perform the command, the console prints out: fatal: pathspec '.' did not match any files on branch master Any input on why this…
user2982130
0
votes
1 answer

Can't remove files from remote repository

I deleted some files from my local repository, and when I type git status it says they have been deleted but when I try to add them it says that they did not match any files.
Sara Alaa Khodeir
  • 349
  • 1
  • 3
  • 9
0
votes
1 answer

How to finally ignore a file in all sub-directories via .gitignore

I know there are lots of duplicate questions but I'm fully confused. I should admit I'm completely new to Git. I'm using RabbitVCS, However, I edit the .gitignore file using gedit manually. That's what I have done: I have created a repository in…
Ali
  • 53
  • 8
0
votes
2 answers

Add all files in git

I have this git status: User#/d/Work/Project/Module1/NV/build (master)$ git status # On branch master # Your branch is ahead of 'origin/master' by 3 commits. # (use "git push" to publish your local commits) # # Changes not staged for commit: # …
Jacob Krieg
  • 2,834
  • 15
  • 68
  • 140
0
votes
1 answer

How to get `git add` to list files that's staged

How do I get git to echo what files that are being staged during git add command? Something like this... > git add app/ app/index.html added > _
ming_codes
  • 2,870
  • 25
  • 24
0
votes
2 answers

Using Git Add with files that maybe don't exist

On Windows, I'm trying to create an alias for Git Add to automatically select only C# related files. My current alias is: acs = add *.cs *.csproj *.sln I keep getting this error: fatal: pathspec '*.sln' did not match any files, which is expected,…
0
votes
2 answers

Unable to do "git add ."

I was able to add my directory to git and do a git commit but strangely, when I am doing $ git add . I am getting the following error: warning: LF will be replaced by CRLF in .idea/workspace.xml. The file will have its original line endings in your…
rahulserver
  • 10,411
  • 24
  • 90
  • 164
0
votes
2 answers

After doing `git commit` git tells me there is nothing to commit

I am on my gh-pages branch and when I $ git add $ git commit -m "" I see # On branch gh-pages nothing to commit, working directory clean Then I will do and see the following $ git stage Nothing specified, nothing added. Maybe you…
user883807
1 2 3
21
22