Git treats Git nested repositories as regular files / folders

I have a top level git repository organized like this:

  • .git /
  • repoA /
    • .git /
    • file
    • file2
    • folder /
    • ...
  • file
  • file2
  • folder /
  • ...

How can I get git before addand commit repoA(and repoA/.git) as if they were regular files / folders?

In particular, I want to bypass the processing of such a folder as a submodule, but I want to save the branches / history of the nested repo (therefore, a folder is required .git).

I do not want to change the state of the embedded repo (by fixing or merging stories) and I do not want to press it on a separate repo on the remote control.

The intended result is the same as if I were tar repoAun- tarlater. That is, all files are not corrupted without any modifications or special git processing.

+4
1

git .

, , " git ":

cat .gitmodules |while read i
do
  if [[ $i == \[submodule* ]]; then
    mpath=$(echo $i | cut -d\" -f2)
    read i; read i;
    murl=$(echo $i|cut -d\  -f3)
    mcommit=`eval "git submodule status ${mpath} |cut -d\  -f2"`
    mname=$(basename $mpath)
    echo -e "$name\t$mpath\t$murl\t$mcommit"
    git submodule deinit $mpath
    git rm -r --cached $mpath
    rm -rf $mpath
    git remote add $mname $murl
    git fetch $mname
    git branch _$mname $mcommit
    git read-tree --prefix=$mpath/ -u _$mname
fi
done
git rm .gitmodules

( )

+2

Source: https://habr.com/ru/post/1613592/


All Articles