Questions tagged [git-add]
git-add - Add file contents to the index
git-add
344
questions
1
vote
0
answers
39
views
Why is "git add -A" so much slower than "git status"? And could I speed up my "git add"s by working from "git status" instead?
In git, I usually prefer to not use the staging area very much, and just work with my working tree. Call me crazy, but I don't get much use out of this extra step before committing, etc., of adding ...
-1
votes
0
answers
38
views
Git: Search for a hunk matching the given Regex across all files
When using git add --patch, / allows you to search for a hunk matching given regex, but only in the current staging file.
But how to search for a hunk matching given regex across all files? Maybe ...
0
votes
0
answers
47
views
Git (v 2.20) is no adding text files others do [duplicate]
I am using git version
git version 2.20.0.windows.1
I have problem with adding *.txt files.
I have created a project. There was only PCB files. At the beginning.
I have commited it.
Then I have ...
-2
votes
2
answers
100
views
Changes not staged for commit - What are the 3-states in Git? How to use them?
I am working on the main branch updating some files but not the ones on the list below, however whenever I run git status I get the message below with the files highlighted in red which suggests there ...
3
votes
2
answers
58
views
Git+Bash / GitBash: Add files matching both first-letter-uppercase or all-lowercase filenames of certain pattern along with respective plurals
I have some Laravel/Livewire files matching filename patterns like seen in below:
app/Livewire/String1Table.php
app/Livewire/String1s.php
app/Livewire/EditString1.php
app/Models/String2Table.php
app/...
0
votes
0
answers
41
views
Configure `git add -p` to split hunks automatically
During git add interactive, is it possible to automatically split the hunk (where applicable)?
-1
votes
3
answers
657
views
How do i fix this fatal:bad boolean config value
$ git push
fatal: bad boolean config value 'origin' for 'push.autosetupremote'
I want to push in git but an error appears as above
im using new version git
I hope to be able to git push some of my ...
-1
votes
1
answer
59
views
How do I solve this problem in github please [duplicate]
I'm getting this warning anytime I try to git add . all my file in my folder: warning: in the working copy of 'calculator-app-main/.gitignore', LF will be replaced by CRLF the next time Git touches it
...
0
votes
1
answer
68
views
How to stage the files to the local git repository where file names has space in them? [duplicate]
I have 2 files locally: File 1.txt and File 2.txt.
When I stage the files with the command git add File 2.txt, it is giving me the below error:
fatal: pathspec 'File' did not match any files
0
votes
1
answer
214
views
git add fails with fatal: src/mytest.pax added file untagged, set correct file tag
When I try to add files to a commit group I get an error.
Command: git add .
Error: fatal: src/python/files/mytest.pax added file untagged, set correct file tag
git —version: git version 2.3....
0
votes
0
answers
36
views
track a file with git repo as well as separate git bare repo
I use to manage my dotfiles with a git bare repository.
However some of my dotfiles are already in git repositories existing for a long time.
I dont want to lose all the change history so I would ...
2
votes
0
answers
58
views
Customize "Stage this hunk" prompt in `git add -p`?
I've started reusing git add -p as a building block for other situations where it's nice to have an interactive interface to accept/reject/edit changes.
It's profoundly useful! The biggest win for me ...
0
votes
2
answers
323
views
Unable to Stage Changes in Git for Specific Files, Getting Consistent Output
I'm currently facing a persistent issue with staging changes using Git. No matter which commands I try, I keep getting the same output when I check git status. The output consistently looks like this:
...
0
votes
1
answer
63
views
Does git add -A respect .gitignore?
I have several target subdirectories in my project that I do not want to track. So I removed them all with:
find . -type d -name 'target' -print0 | xargs -0 git rm --cached -r --
I also added ./*/...
0
votes
1
answer
45
views
How can I `git add` on cloned git repo by SSH?
I can git add just add new file on repo directory. but when I make directory and add new file to this directory, I cannot git add.
Note:
I ran git clone for clone private repo by ssh public key
$ ...
-1
votes
1
answer
632
views
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?
0
votes
1
answer
57
views
How to include untracked files in a command like `git commit --dry-run -a`
I'd like to review that Git is going to properly detect files as moved, rather than deleted/added new - but there doesn't seem to be any way to preview the operation - it seems like my only option is ...
1
vote
2
answers
299
views
Although seemingly correct Syntax .gitignore File is ignored
I have written some powershell code, since I wanted to achive two things.
The first one was to organize my gists and the second one to learn ps1 script syntax.
Until now I guess I've managed some ...
0
votes
2
answers
310
views
how can i add one of my file in the .gitignore file?
I'm new to coding.
I learned about the .gitignore file today, and I succeeded in adding an unwanted file to the .gitignore file but could not add one file on the .gitignore file.
Untracked files:
(...
0
votes
1
answer
55
views
Any way to automate partial checkins, excluding changes checked in elsewhere?
I'm someone who's always constructing checkins of only a portion of the differences in my worktree, so some of git's special features — notably git add -i -p and -e — are a real boon. But as useful ...
3
votes
1
answer
588
views
Why is "git add" adding "C:/Program Files/Git/" in front of a given path starting with "/"?
While I am trying to do git add for a folder or for all files, I am getting the fatal error as shown below.
MINGW64 /c/xampp/htdocs/d95x-dev (master)
$ git add /vendor
fatal: C:/Program Files/Git/...
1
vote
1
answer
178
views
git-add and git-diff use different diff tools?
TL;DR I configured a difftool and git-diff gives "intelligent" diffs but git-add creates "stupid" hunks. Why?
I configured the difftool to use nbdime with nbdime config-git --...
0
votes
1
answer
67
views
Commit separately specific files inside untracked new directory in git
I have a new created directory "supplier_directory", in which there are 3 new files. I need to add these files into different commits.
Commit N1 : file1 only
Commit N2 : file2 and file3
I'...
0
votes
0
answers
103
views
Broken repos by applying git clone and add . to a parent folder
This is the 2nd time it happens to me. The first time I thought it was a hard drive problem.
I'm trying to back up all my projects, that don't have a Repos in it. Because of my bad practices, I've ...
0
votes
1
answer
762
views
git add giving a super long never ending output [duplicate]
So I am kinda new to git and github and wanted to push a project on github. However, when I add files
git add .
it gives a super long message that does not seem to end
warning: LF will be replaced by ...
-1
votes
1
answer
486
views
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 ...
1
vote
1
answer
181
views
How can navigate one level back at the git interactive staging (add) command
After running the interactive staging git command $ git add -i and choosing one of the options for example "update", then I don't know how to get back to the root level to choose another ...
3
votes
1
answer
164
views
change color of "Stage this hunk" query in git bash
when doing git add -p in the git bash terminal, the query "stage this hunk" comes up in a very dark blue that is very difficult to see on the black background.
How can I change this to ...
1
vote
2
answers
191
views
git add/rm files based on the type of change (of the files)
Is there a way to stage or unstage (git add / git rm) files only based on what was the type of modification?
Like :
add/rm only files that are deleted
add/rm only files that are new
add/rm only files ...
3
votes
1
answer
833
views
`Git add --patch` multiple files: go to hunk from previous file
When running git add --patch, it presents a series of "hunks" that can be applied or skipped with y or n respectively, along with other options for editing/etc.
On occasion, when working ...
1
vote
0
answers
159
views
How do I tell git that I only want to add the current file content of a child repo, not the repo as a submodule
If you clone a git repo inside of another git repo (e.g. to install code for a library or plugin into the parent repo) it appears impossible to add the file content of that directory to the parent ...
0
votes
2
answers
1k
views
what does git rm do as opposed to deleting by OS and git add
If we want to delete a file (say file1.txt) and stop the git repo to track it, it is said that we should use git rm file1.txt and then git commit -m "..." it. But deleting from the working ...
1
vote
0
answers
74
views
How to commit and push a database file of 60 or more Mbs using Python3.x to GitHub API?
I have been looking for a better way to automatically upload a new or existing file to my repository. The following code can only update an existing file (not a big deal for me now) and does not work ...
3
votes
1
answer
314
views
unable to add files with git add
I have tried to git add a file. But when I check git status, the file is still marked as "Changes not staged for commit".
I have read many similar questions and I have tried everything:
...
0
votes
2
answers
73
views
Command to tell git to not track certain files
I know there is a shortcut for this, and cannot remember it.
I am working in a repository, and have about 8 files I need to add and commit, and 2 that are modified, that I do not need to commit. ...
0
votes
1
answer
405
views
Files not being added to repository on Github-- repository appears empty
I added a new repository to Github. For some reason, my files didn't show up after following the command prompts. I checked Git to confirm that my website was in the repository and it shows that it is....
4
votes
2
answers
1k
views
Why should someone use git add before git commit? OR why should someone use git add at all?
I am not an expert in git and I understand that the whole idea behind version control is to be able to record the history of the files. If we can keep track of changes made to files in the working ...
-1
votes
1
answer
2k
views
the "git add <file_name>" 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 ...
0
votes
2
answers
557
views
Git stash partially staged file
Is there a way to stash partially staged files (created with git add -p) in a straightforward easy manner? I already know about git stash -p which behaves like add but with stashing, but I already ...
1
vote
0
answers
68
views
Is it possible to undo a `git add` and go to the exact same staging index as before?
I was trying to split my work into multiple commits. I have done this:
git add --patch my_file
# accepted, rejected, manually edited many hunks
# --->
# now my silly mistake comes
git add my_file
...
1
vote
0
answers
512
views
Git: How to track file from submodule folder in main repo?
I have a repository with a project, which contains several plugins. Plugins are added to the project as git submodules. Everything work okay, but the project may change some files in plugins while we ...
1
vote
1
answer
115
views
How does `git add` deal with changes like file<->directory?
This is a long question. I'm trying to reverse-engineer some basic Git functionalities, and am having some trouble wrapping my head around what git add really does under the hood. I'm already familiar ...
1
vote
1
answer
121
views
How to add all files to stage whose file path is given in a file
Let's say I have a file files_to_stage.txt having file paths like
src/a/a1.txt
src/a/a2.txt
src/b/b3.txt
src/b/b6.txt
src/c/c5.txt
Now I want to stage all files having paths present in files_to_stage....
0
votes
3
answers
1k
views
Undo .gitignore changes
I previously ignored a folder, but now I would like to ignore its content only: How do I remove/modify some entries from my .gitignore file so that git will track them again? I tried updating the ...
5
votes
1
answer
900
views
Can I mark a file for resolution without adding it to the index with one command?
When there's a conflict, git status shows this:
Unmerged paths:
(use "git restore --staged <file>..." to unstage)
(use "git add <file>..." to mark resolution)
...
0
votes
1
answer
130
views
How merging works when we use git add <filename>?
Assume this is my project structure:
- project
- .git
- scr
- component
- file.js
I did clone the project
Made a new branch by git checkout -b "newBranch"
Made ...
3
votes
2
answers
1k
views
WSL+samba+git: "error: insufficient permission for adding an object to repository database .git/objects" / git-clone / git-add permission errors
I'm working on Win10 using the WSL1 (Windows Linux Subsystem) with Ubuntu 20.04.1 LTS. I have a Samba (1.0) Network Share on which I want to create my git repository via my Ubuntu Terminal.
christian@...
-2
votes
1
answer
38
views
Set git globally add certain files of type [duplicate]
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?
-1
votes
2
answers
103
views
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 ...
4
votes
0
answers
321
views
How to refresh a chunk's diff, during `git add -p`
When staging files with git add in patch mode (-p) I sometimes find a mistake that I would like to correct, before keeping on with adding further changes.
Many possible options are prompted: confyrm, ...