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

git- filter certain file

I have a constants file, this file is needed but every developer keeps changing this for his environment and often pushes this changed file. Is there a way that there can be a filter where in this constants file will not get added/pushed. .gitignore…
0
votes
2 answers

Git commits un-staged changes of previously staged file, contrary to git-scm book

The section of the book: http://git-scm.com/book/en/Git-Basics-Recording-Changes-to-the-Repository#Staging-Modified-Files says that if I change file A, run 'git add A' and then change file A again, run 'git commit' on this file, only previously…
alexy2k
  • 560
  • 1
  • 6
  • 10
-1
votes
1 answer

can't clone or add in git repo

when ever I'm trying to check my git status or want to clone in my repsitry the cmd is showing me this, can someone report a problem & help me out with an error?
-1
votes
1 answer

Cant pull nor commit from git for untracked file

I was trying to pull from a repo and it gives me that message but if I run git status it says that my working tree has diverged and if I try to add and commit it gives me that error, (btw those files in the .gradle folder are in the .gitignore file…
-1
votes
1 answer

the "git add " command leads to the error "fatal: pathspec 'file_name' did not match any files

Before you mark as duplicate, I am referencing this similar question: Fatal: pathspec 'file.txt' did not match any files, GIT However my issue seems slightly different from the one posted there. I am a complete beginner with Git and GitHub. I have…
Trixie the Cat
  • 317
  • 3
  • 18
-1
votes
2 answers

Why does 'Git add *' leave some files unstaged?

I initialized a new git repo in my Django project. All files( including the files in subdirectories and pipfile) are staged when I run git add * except the .__atomic-writegxd2tirf file. Why is this one excluded?
-1
votes
2 answers

can't git add . files, how do i git add , the right way?

Hi I am new on ruby on rails, I am creating an app with the ruby on rails version 3. I am having trouble, I have a lot of files to add. I type command git status and the following comes up , then I typed git add . and nothing happens. What am I…
-1
votes
2 answers

How do I add the src directory instead of the individual files?

I've created a directory called 'src' which contain the files 'level.txt' and 'notes.txt': Remys:git-practice Remyce$ cd src Remys:src Remyce$ ls level.txt notes.txt How do I add the src directory instead of the individual files? It keeps…
-1
votes
2 answers

Is there any way to undo a "`git reset .`"? It 'reverted' all files - all edits have been lost from my working directory

I staged a grand number of files for commit. Then I realized it was better to commit only two of the files, and then commit the remaining ones in a separate commit. git reset unstages filename I wanted to unstage everything, then restage…
SherylHohman
  • 16,580
  • 17
  • 88
  • 94
-1
votes
1 answer

How to switch local branches various scenario

I need to have some strategies while using Git as my version control. Following are few scenarios while using local branches. Can someone, please, explain how can I deal with those: A and B are local branches X is remote branch A is pulled from X,…
-1
votes
1 answer

Doing a commit in github

Actually i am a beginner in using github. so here is my question.when i try to show commits in github i have a problem,so before adding the modification when i run git status i not only get the modifications inside the file as changes modified but…
slo-loris
  • 23
  • 6
-2
votes
1 answer

Set git globally add certain files of type

I want to setup git to stage only certain files of type. With git add * in basic dir, i must stage only the files of type cpp,h,txt,html. How i must do this?
jim kaip
  • 1
  • 5
-2
votes
1 answer

Can't add a file to git, seriously

Solved, as explained in a comment under the accepted answer. I have been using Git since years and I am really surprised that I there is one specific file that I can't add to the staging area in one of my repos! I don't want to delete and recreate…
Nisba
  • 3,210
  • 2
  • 27
  • 46
-2
votes
2 answers

What happens when user does "git push" before "git add" and "git commit"?

I was working on a project made some changes in my code (in Itellij IDE) and by mistake I did below two steps in my terminal and I saw some changes went into the main respository (not my changes or anything I had worked previously). Does anyone know…
Kasid Khan
  • 639
  • 2
  • 8
  • 23
-7
votes
2 answers

If a file is being tracked and you modify it, can you commit without adding?

Assuming that is being tracked by git, is git commit -m "message" possible without doing a git add ?
Arun
  • 1
  • 1
1 2 3
21
22