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

Unable to add folder to git repo

I think this issue has already been discussed under this question : Recursively add the entire folder to a repository However I still can not add some folders to a git repository and I need help. $ git status ... # modified: folder_to_add1…
Jose Tabisi
  • 9
  • 1
  • 4
0
votes
1 answer

How can I interactively assign chunks (diff hunks) to a set of new commits?

Sometimes, after I have made multiple changes to multiple files, I want to split them into a set of new commits. I know about the --patch option to git add and git's interactive mode. But as far as I can tell, those force me to step through all…
maf
  • 305
  • 1
  • 9
0
votes
0 answers

git add wont stage files - git cache confused?

I have a feeling my git cache is getting confused fairly often. I work on Mac and use both git at terminal and SourceTree. I add or modify few files but I often notice that even files I have never modified in any way show as staged. This is very…
pixel
  • 9,653
  • 16
  • 82
  • 149
0
votes
1 answer

SourceTree / git add - Fail to stage modified files

I use SourceTree daily and never had such issue. But today I did some minor change and now I ended up having this issue: What I changed today? I added p4Merge as merge tool and diff tool in my git config. Then I changed my mind and deleted entries…
cd491415
  • 823
  • 2
  • 14
  • 33
0
votes
2 answers

fatal: pathspec 'editme.html' did not match any files

I have cloned a git public repo on Mac OSX. I made some changes to editme.html file and want to add and commit after that. But command line shows like this: dips-MacBook-Pro:test-repo kirandip$ git add editme.html fatal: pathspec 'editme.html' did…
K. Kaur
  • 59
  • 1
  • 1
  • 7
0
votes
0 answers

Git add . adds files from .gitignore

if relevant: Laravel. PHP 7.0.3 Hi! I had to delete 'vendor' folder in my project and do "composer install" to re-install all libraries. Then I modified some project's files (outside "/vendor"). git status showed me not only my project files…
Sergej Fomin
  • 1,822
  • 3
  • 24
  • 42
0
votes
4 answers

git add . adds changes of other projects too

I am trying to add all changed files to GitHub by using git add . but it also adds the changes made by me on other local projects. It should ideally add the changes of the same project. How should it be solved? When I run git status then I get to…
Shrreya Behll
  • 185
  • 1
  • 10
0
votes
1 answer

undo submodule and make it a directory to a github repository

I cloned a repository from github, and I would like to make it a directory in an other github repository. Though it is considered as a submodule (and I don't want it to be a submodule, but a directory). In this directory i have some script that I…
D Prat
  • 352
  • 4
  • 16
0
votes
1 answer

GIT preserve sample data unique to each local repo/machine when pulling to the same file

My query may not be obvious from the question title so I'd give an example, Let say my html file index.html on Machine-1 is as follows: MACHINE-1
dkjain
  • 831
  • 1
  • 9
  • 36
0
votes
1 answer

Git Testing Partial Commits Merge Conflict

I've been working on a project for the past couple of hours and when you're using the trial and error strategy you most likely forget the commit changes that should be in separate commits to keep a clean history. At least, that was what happened to…
Julian
  • 837
  • 1
  • 11
  • 24
0
votes
1 answer

committing a file to another branch

I have a project managed with git with multiple active branches. e.g. feature1, feature2, feature3,..., master I was working feature1: I have created files, made modifications, committed and pushed my changes to remote feature1. Now I have realized…
00__00__00
  • 4,834
  • 9
  • 41
  • 89
0
votes
0 answers

How to Add Modified Changes to File Without Adding the Entire File in Git?

I used git checkout to pull a file from a certain branch on Git, and made the small modified changes to it. However, I don't know how to add the changes without adding the whole file.. meaning that I am using git add to add the file I just…
C. Lewis
  • 145
  • 1
  • 6
  • 17
0
votes
1 answer

Unable to add file to index using eGit plugin (Eclipse Neon3)

Eclipse is showing the below error when I select to add a file to index. Is there any way to fix this? Failed to add resource to index Failed to add resource to index Exception caught during execution of add command Below is the stack…
0
votes
1 answer

git add . or -A is adding .gitignore file in commit list, how to get ridoff this?

If I change a bunch of files and then run command git add . it includes all the files along with .gitignore in my commit list. If I use git rm --chached .gitignore then it is showing as deleted: .gitignore and git add . is adding the deleted…
ray
  • 4,210
  • 8
  • 35
  • 46
0
votes
1 answer

Git and add -p problems

I have just applied a patch to 3 files, their diff can be seen here: stack.h, stack.c and main.c. The task is to separate the patch into various commits, like comments, license, refactoring etc. For that I will use git add -p: First hunk is license…