Home > Software engineering >  Is exists a way to commit several directories not in a tree structure in only one master branch on g
Is exists a way to commit several directories not in a tree structure in only one master branch on g

Time:05-10

What I'm trying to do is git in a one master branch the following structure:

/var/www/mysite/public_html
/dev/only_this_file.txt
/etc/directory/things
/other/other/other/other

and everything without generating any git file inside any of those directories or subdirectories, that must be untouched.

Is this possible?

I'm working on Debian Buster

CodePudding user response:

you can use a working directory with the use of --git-dir and --work-dir (or the corresponding environment variables GIT_DIR and GIT_WORK_TREE)

e.g.

cd /var/www/mysite/public_html
export GIT_WORK_TREE=$(pwd)
git --git-dir=/home/git/mysite init
git --git-dir=/home/git/mysite add *
git --git-dir=/home/git/mysite commit

(you would probably want to define an alias that sets the proper arguments)

i don't think you can have multiple disjoint working-trees living in the same git repository.

  • Related