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
2
votes
1 answer

git add -A does not adding all files of project to git repository

I have just created new repository on github and trying to add my project on git. When my friend tried to clone using git clone this project, some files of my project were not cloned. On inspecting more on this, I found that these files were not…
Kesha
  • 497
  • 6
  • 19
2
votes
1 answer

git add -A not working

Even after doing git add -A, when I run git status, I get this: # On branch master # Changes not staged for commit: # (use "git add ..." to update what will be committed) # (use "git checkout -- ..." to discard changes in working…
Dohn Joe
  • 33
  • 1
  • 4
2
votes
1 answer

Git one-liner to add everything (including untracked files) and commit

I'm really lazy, so I often like to run git commit -am 'msg' to add and commit everything in one swoop. If I'm lucky, I haven't added any untracked files and this will work fine. However, sometimes I'll do this, run git status much later in the…
James Ko
  • 32,215
  • 30
  • 128
  • 239
2
votes
1 answer

git add or untracked file cancel

I have some questions about undo git add and git reset. Recently I made some mistakes. First, I added all directory's files. And I want to cancel added. Then, some of the directories are removed after I wrote a git rm- command. Second, Still,…
김준태
  • 33
  • 4
2
votes
1 answer

GitBash / GitExtensions issue committing local changes

I am a get newbie. I have completed development and ready to check in my files. I thought I checked everything in, but when I look at my repo, I see a sub-directory was not checked in. So I tried to force the git add . -f but I got this error: `$…
Robert Green MBA
  • 1,834
  • 1
  • 22
  • 45
2
votes
1 answer

Git ignoring add with wildcard for some files

I have a project am working on: there I have many files, I can do something like: git add *.cvs and git gently add all csv files for commiting, so far so good... but if I try to do the same with *.html files, git just ignore my commands, then I…
ΦXocę 웃 Пepeúpa ツ
  • 47,427
  • 17
  • 69
  • 97
2
votes
2 answers

git bash shell on Windows “Your edited hunk does not apply” (continued)

Not too long ago, I asked this question. I received an answer, but it did not solve the issue I was having, so I was advised to create a new question with more detail. Just to reiterate, I am getting an error when trying to manually edit a hunk in…
Atreyu
  • 639
  • 2
  • 7
  • 16
2
votes
0 answers

How to undo the work after git add?

There are many questions about git, so I google for a while before I asked here. I've not find any useful info. Just make it easy, cat a.txt >> c.txt git add . cat b.txt >> c.txt how to undo the last cat command. Note here is just a simple to…
LF00
  • 27,015
  • 29
  • 156
  • 295
2
votes
2 answers

Undo Add Files in Git

I had a bunch of files in the directory in git that weren't tracked. I made the mistake of doing git add . then committing and pushing the changes. How can I get back to where the files that were untracked before that commit are untracked again, but…
theEpsilon
  • 1,800
  • 17
  • 30
2
votes
1 answer

GIT removing files in symlinked folders, adds them back on second run of git add -A

I have a directory structure as such: -main -sym-linked-dir some-file.txt some-other-file.bar -sym-linked-dir-2 -some-dir some-doubly-nested-file.foo -normal-folder spam.eggs pan.cakes …
Harry Mustoe-Playfair
  • 1,369
  • 16
  • 29
2
votes
3 answers

Git converting CRLF to LF in images

Everytime i add a new image to my project, Git convert CRLF to LF. It would be okay if the files came from windows, but it does not, I'm on Debian ! The files i'm getting from "pull" on my remote server are then corrupted =/
Shakealot
  • 133
  • 10
2
votes
1 answer

Git add all files also from nested git repos

My dotfiles repository has some tmux plugin directories which are themselves git repositories. When I do git add -all these nested repos are ignored. Is there a way to ignore the git semantics of these nested repos and treat everything as regular…
ElefEnt
  • 2,027
  • 1
  • 16
  • 20
2
votes
2 answers

Git sees duplicated modified file

In my repository there is a file (always that one) that always gives me trouble. I'm working with coffeescript and generating the js with a grunt task. For several times git status told me that this file was modified and needed to be added. The…
Leonardo
  • 4,046
  • 5
  • 44
  • 85
2
votes
2 answers

git add submodule hash directly

Is there a way using git commands to directly update the submodule hash in the index? If not, is there a way to manually change it via modifying text somewhere in the .git directory? I want to point to a specific commit in a submodule, but I want to…
mattgately
  • 932
  • 8
  • 22
2
votes
1 answer

Perforce equivalent for git add patch?

git add --patch is very important to me. It shows all the diff chunks, and I say "yes" or "no" to add them to the index, from which I commit. In particular if I added something like a console.log in some random file, it won't be picked up in my…
djechlin
  • 59,258
  • 35
  • 162
  • 290