Questions tagged [git-add]

git-add - Add file contents to the index

Filter by
Sorted by
Tagged with
0 votes
0 answers
19 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 ...
justanotherhumanbeing's user avatar
2 votes
0 answers
30 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 ...
mtraceur's user avatar
  • 3,304
0 votes
2 answers
68 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: ...
sanbinary's user avatar
0 votes
0 answers
18 views

.DS_Store "Changes not staged for commit?" [duplicate]

I'm very new to coding so please be patient On a macOs. I had help from a tutor to move my .ds_store and future .ds_store files into my .gitignore file, (wasn't aware what a .ds_store file even was ...
Whats_a_pj's user avatar
0 votes
1 answer
49 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 ./*/...
brianxk's user avatar
  • 63
0 votes
1 answer
43 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 $ ...
TaeUk Noh's user avatar
  • 116
-1 votes
1 answer
208 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?
Asfathareem's user avatar
0 votes
1 answer
43 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 ...
Slbox's user avatar
  • 11.1k
1 vote
2 answers
184 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 ...
L00tz1ffer's user avatar
0 votes
2 answers
202 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: (...
calipalm's user avatar
0 votes
1 answer
52 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 ...
Steve Summit's user avatar
  • 45.6k
1 vote
1 answer
351 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/...
ASHISH SINGH's user avatar
1 vote
1 answer
153 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 --...
gchen's user avatar
  • 126
0 votes
1 answer
63 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'...
oussa amh's user avatar
0 votes
0 answers
89 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 ...
user avatar
0 votes
1 answer
473 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 ...
Milanor's user avatar
  • 51
-1 votes
1 answer
364 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 ...
Jonatan Sciaky's user avatar
1 vote
1 answer
112 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 ...
muel's user avatar
  • 53
3 votes
1 answer
135 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 ...
db_'s user avatar
  • 113
1 vote
2 answers
154 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 ...
eshirvana's user avatar
  • 23.3k
3 votes
1 answer
536 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 ...
Human-Compiler's user avatar
1 vote
0 answers
143 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 ...
David Scotson's user avatar
0 votes
2 answers
896 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 ...
b3hn4m's user avatar
  • 75
1 vote
0 answers
68 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 ...
Egidius's user avatar
  • 981
3 votes
1 answer
226 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: ...
Andre's user avatar
  • 321
0 votes
2 answers
67 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. ...
tx291's user avatar
  • 1,261
0 votes
1 answer
95 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....
Sarahs-code's user avatar
4 votes
2 answers
884 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 ...
Shreemaan Abhishek's user avatar
-1 votes
1 answer
1k 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 ...
Trixie the Cat's user avatar
0 votes
2 answers
499 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 ...
uloco's user avatar
  • 2,293
1 vote
0 answers
64 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 ...
Asocia's user avatar
  • 5,955
1 vote
0 answers
365 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 ...
Alexander Blintsov's user avatar
1 vote
1 answer
94 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 ...
Eldrax's user avatar
  • 499
1 vote
1 answer
94 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....
CodeTalker's user avatar
  • 1,693
0 votes
3 answers
958 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 ...
joyfantastic's user avatar
5 votes
1 answer
752 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) ...
Enlico's user avatar
  • 23.6k
0 votes
1 answer
110 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 ...
stack's user avatar
  • 10.3k
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@...
chris h.'s user avatar
  • 265
-2 votes
1 answer
36 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?
jim kaip's user avatar
-1 votes
2 answers
93 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 ...
optimistic-zia's user avatar
4 votes
0 answers
257 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, ...
Kamafeather's user avatar
  • 8,703
5 votes
3 answers
10k views

How do I see git added files?

Sometimes I run git add . and big files that weren't supposed to get added are added. How can I see which files were added without commiting? And how to 'un-add' those files or all files at once so I ...
Paprika's user avatar
  • 412
-2 votes
1 answer
839 views

Can't add a file to git, seriously [closed]

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 ...
Nisba's user avatar
  • 3,210
0 votes
3 answers
924 views

What does git add do?

I initialized a folder with git init. The size of contents in that is around 600MB. After doing git add, The size of .git became 600MB, So, It literally stores all the contents of my files? I thought ...
Appaji Chintimi's user avatar
1 vote
1 answer
77 views

See the full git add patch

I use git add -p all the time. For large hunks I often go into (e)dit mode to review and adjust the hunk as desired. Is there a way to edit the FULL diff (every hunk in every file), rather than make ...
Taylor Vance's user avatar
0 votes
1 answer
340 views

"error: ... patch does not apply" when editing hunk with "git add -p"

tldr: why am I getting error: ... patch does not apply when editing a hunk and removing a line, even though it looks like it should work? I'm editing a hunk while doing git add -p, where I want to ...
Rob Bednark's user avatar
  • 26.1k
1 vote
1 answer
830 views

git add line by line and not by paragraph

Is there a way to add line by line in git. I tried this: git add -p But this command is not performant for me. because I need to treat each line separately. If there is no a solution, I'm ...
Karim Oodrive's user avatar
1 vote
1 answer
1k views

Git commit adds/removes files not staged for commit

I'm fairly new to using git and I've dug myself in to a hole a couple of times where one of my git commits ends up modifying files that do not show up when doing a git status. I'm curious if anyone ...
Peter G's user avatar
  • 11
1 vote
1 answer
256 views

When rebasing, why doesn't git add --patch work?

In a git repository, I have a single file with a large commit I want to divide into multiple commits. I am trying to follow the instructions at this answer but I have run into a problem. git status ...
user2350838's user avatar
1 vote
1 answer
928 views

How do I "git add" a modified submodule into the main module?

I modified, added, committed and pushed a change to a submodule, then went up to the main module directory and ran: # git status ... Changes not staged for commit: ... modified: deps/gr-d13 (...
Grant Schmick's user avatar

1
2 3 4 5
7