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

Hide/Encrypt part of file in Git

I have version control with Git over the configuration files of a server. A file (namely app.ini from Gogs) requires the database user and password to be stored in cleartext. Is there any way to transparently commit the file without the password…
0
votes
1 answer

How to merge specific commit id from different branch in same repo

I had two branches master & trunk. I have created one more branch in local using git checkout -b new_branch origin/master to take the master code in that branch. I have added committed some changes in this new branch & pushed as: git add --all git…
Akhil Gupta
  • 187
  • 3
  • 13
0
votes
0 answers

Receiving "patch failed" and "patch does not apply" errors after running "git add -e"

I can't seem to run "git add -e" in either Powershell or Git Bash without getting errors. Here are the file (test3.html) contents in question: test Hello Note that…
user6312047
0
votes
1 answer

How to track sub-directories that change accurately with git

I am having a bit of difficulty picking up git. While tracking and committing text files is easy, every time I add a Visual Studio project folder to a repository, git throws this (modified content) status at me and I can not get it to add the new…
Perplexing Pies
  • 123
  • 1
  • 1
  • 9
0
votes
1 answer

git-svn problem with git add --patch resulting in conflicts

Basically when i want to commit two separate changes in the same file that resulted from an git add --patch operation, git svn rebase later on throws 1-2 conflicts upon comitting the second change when using git add for the second change. so…
Zenon
  • 1,436
  • 1
  • 11
  • 21
0
votes
3 answers

Git Push Errors when pushing to Github

I have been tirelessly trying to push a file to Github from Git. From incomplete loading processes to duplicate files--I need some serious help trying to rectify this issue. The following are the error messages received: $ git push origin…
0
votes
1 answer

Did a Git add, stash and pop. Failed to restore my changes

I am on branch1 --> did some changes --> did a git add, then did a git stash save --> switched to branch2 --> did some changes --> add, commit and push --> Now switch back to branch1 --> did git stash pop stash@{0} ===> My changes are gone :( How…
prago
  • 5,225
  • 5
  • 25
  • 27
0
votes
1 answer

How to remove file from remote repo without doing anything locally in git?

Here's my situation: I wanted to do a once-and-done push to a git repo. So, I did the add, commit, and push as usual. Except, I forgot that I had other files in previous commits that also got pushed. So, now there are unnecessary files…
makansij
  • 9,303
  • 37
  • 105
  • 183
0
votes
0 answers

How to tweak the line numbers for git add -p

I'm trying to remove the import sys and import os lines from one hunk of my script: diff --git a/GFF/fastas2GFF.py b/GFF/fastas2GFF.py old mode 100644 new mode 100755 index 88850cd..8226717 --- a/GFF/fastas2GFF.py +++ b/GFF/fastas2GFF.py @@ -1,13…
ppflrs
  • 311
  • 4
  • 11
0
votes
1 answer

Troubles with git am when applied in a different repository

I have two Git repositories: /api/pom.xml /jpa/pom.xml /mailbox/api/pom.xml /mailbox/jpa/pom.xml /protocols/api/pom.xml The second repository have a mailbox folder that has the exact same structure that the first Git repository. Due to workflow…
Benwa
  • 91
  • 4
0
votes
2 answers

Can I make git reject an all-commit if I have before manually added files?

Most of the time, I commit with git commit -am, because all I've done to the project belongs to the commit I'm working on. Only sometimes, there are some changes I do not want to commit, so I use git add -p to stage only what I really want. Trouble…
leftaroundabout
  • 117,950
  • 5
  • 174
  • 319
0
votes
1 answer

Git documentation: about `revert` subcommand of `git add -i`

Git documentation about the revert subcommand of git add -i: revert This has a very similar UI to update, and the staged information for selected paths are reverted to that of the HEAD version. Maybe I incorrectly understand this text... I…
Andrey Bushman
  • 11,712
  • 17
  • 87
  • 182
0
votes
0 answers

Git jumping back to history after adding and removing files has different behaviour?

I'm a new comer to git. I found something interesting. Say if I add a file and commit. After I checkout to the previous version, the file doesn't exist as I expected. (Since in the last commit, it hadn't been created) However, if I remove a file and…
0
votes
1 answer

Git - Adding files to the index without committing them

I am working in a project of around 50k files, of which I am only modifying a few of them. I have the project locally in my computer and I am using Gitorious to push the changes I make to it, but as for now I have to manually look for the changed…
Daniel
  • 406
  • 1
  • 4
  • 14
0
votes
2 answers

.gitignore to retain one file

I'm trying to create a cronjob to backup all my Jenkins configuration in git. The only thing I need to be tracked in my repository is the config.xml in every Jenkins project. The file system is structured like…
mheinzerling
  • 1,035
  • 1
  • 10
  • 31