I have a client that I do work for via a git repository. I do not want for him to know that I am partly using another developer. I have therefore created a "shadow" repository, that my developer is using.
How to sync the "shadow" repository with the main repository so that the main repository does not know that this is happening?
Is there a different way that I could "secretly" copy the content of files from the shadow repository to the main repository? Is there a linux/osx-command I could use that replaces the content of a file without deleting and recreating the file (which I then could use recursively)? Is there a git-command that make this possible without leaving a trail of evidence of what I have actually done?
you can have the same set of local files revisioned by different git repositories, using the command line. Just use the GIT_DIR environment variable. The Git repositories are completely independent, and can track files from the same directory.
rem set Git to use the sub-developer's git repository
set GIT_DIR=/path/to/sub/repository.com
rem verify which repository that you are on
git rev-parse --git-dir
rem pull the sub-developer's latest
git pull
rem merge, commit, change, push, change branches, whatever
rem ... when the code is the way you want it
rem switch to client repository
set GIT_DIR=/path/to/client/repository.com
rem bring main repository up to date
git commit -m"changes brought over from sub-developer"
rem push the updated code to the client repository
git push
this is useful for other development practices, like versioning lab data, local developmental utilities, work logs, and other 'misc' files that seem to accumulate with the source code, but shouldn't be archived with it.
After my error on the first answer, I feel compelled to try again.
try reading in the sub developer branch and comparing/merging to main with git differencing. see 'git help config' for 'diff.external'. I use diffuse.exe and a batch file to map the parameters.
The work flow would look something like this.
rem make a remote to the sub
git remote add MYSUB https://path/to/sub/repository.com
rem see what branches are there
git remote show MYSUB
rem get the branch from the subdeveloper
git fetch MYSUB CurBranch:CurBranch
rem view/manually merge just the modified files
git diff --diff-filter=M MYSUB/CurBranch
rem cleanup
git branch -D MYSUB/CurBranch
git rm MYSUB
rem push to main site
git push
This is the method I use to transfer branches to my lab machine, via a USB memory stick. I have not tried it with a remote connection.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.