top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

GIT: Add a collection of files

+1 vote
269 views

Is it possible to configure git to see a group of files as a singular object?For instance, I have a directory with several files:

myjunk/text.txt 
myjunk/somefile.exe 
myjunk/anotherfile.odt

Whenever a modification is made, I would like to see just "myjunk" as modified, not the files beneath. For all intensive purposes, git treats myjunk/* as a single binary file.

posted Oct 17, 2013 by Garima Jain

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

I think that no, it's impossible: Git does not track directories, and only copes with them because it has to (filesystems on mainstream OSes are hierarchical).

On the other hand, you could use the fact git add is able to add multiple files in one go:

git add myjunk
or
git add 'myjunk/*'

(notice that I protected the asterisk from the shell).

answer Oct 18, 2013 by Bob Wise
Thanks for the response. It feels like if I want to do this, I need to make a custom git gui that collects the objects and then runs git add like you show.
Similar Questions
+2 votes

I have a local repository and want to change the master branch to a server git. (I just don't want to delete all files in repository and then clone the server files)How to do that? I guess I have to fetch server data into local directory, merge an push it. Can someone please explain me how to do?

+2 votes

How can I add a file later to a commit? I created a new branch and submitted a commit with 2 files.

I observed, that one more file should have been submitted with this commit, so I would like to add a file to an earlier commit.

Any solution for this?

...