FAQ Database Discussion Community


How to add specific files in git by their number in git status?

git,git-add
I often encounter the following scenario: modified: assembly/main.debug.s modified: ../src/cd/Config.java modified: ../src/cd/memoization/cfg/SubgraphFinder.java modified: ../src/cd/memoization/cfg/SubgraphMap.java modified: ../src/cd/profiler/Profile.java modified: ../test/cd/test/TestSamplePrograms.java modified: ../../notes/20150521.txt Here I have a bunch of files and I want to include them in different commits. What I do so far is to do a bunch of git add <pathspec>...

git add submodule hash directly

git,git-submodules,git-add
Is there a way using git commands to directly update the submodule hash in the index? If not, is there a way to manually change it via modifying text somewhere in the .git directory? I want to point to a specific commit in a submodule, but I want to avoid...

Can git ever send your code to a repo that isn't yours?

git,github,git-commit,git-add,git-init
Can running git add . git commit -m "message" in a git repo which you've initialized using git init ever result in your code being sent to a repo that is not yours? I am concerned because I did this while not logged in to my git hub account....

Git - Adding files to the index without committing them

git,git-push,git-commit,git-add
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...

git remove a file that no longer exists on the system

linux,git,git-commit,git-add
I have never encountered this problem before and have no idea how this is possible. I had a really large directory that I downloaded by mistake into my git repo. I inadvertently did a git add . so the large directory got added to the working tree and when I...

How do you stage parts of a new file?

git,git-add
I tried the suggestion here: How to stage only part of a new file with git? git add -N new_file git add -i But I can't get it to work because the interactive mode presents the whole file without the s choice, which would enable me to split the file...

git add all tracked files - also those in parent directory

git,git-add
Lets say I have a git root folder mine_git, which has a subdirectory subdir there. So I've worked a bit, and I'm in subdir - git status lists all changed files: subdir$ git status -uno # On branch master # ... # # modified: mysubdirfile.txt # modified: ../a-main-file.txt # no...

How to add an existing nested repo (already checked out in a subdir) to a parent Git repo as a submodule?

git,git-submodules,git-add,git-init
What happens if I'm creating the initial commit from my working (parent) directory, but there are subdirs with independently checked-out git repos? I simply did git add . but that brought me to a strange situation when the subdirs with nested Git repos are not registered as submodules of the...

Git add single subdirectory recursively

git,git-add
I know I can add everything in my working directory with the following syntax: git add . I also know I can add the contents of a subdirectory with this syntax: git add subdir/* But how do I add everything (recursively) in a single subdirectory? I imagine it looks something...

Git sees duplicated modified file

git,git-add,git-status
In my repository there is a file (always that one) that always gives me trouble. I'm working with coffeescript and generating the js with a grunt task. For several times git status told me that this file was modified and needed to be added. The problem is that git sees...

.gitignore to retain one file

git,jenkins,gitignore,git-add
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 ../jenkins/jobs/[PROJECTNAME]/config.xml. The .git is located in jobs. I don't want to explicitly...