0

I currently have a project with several workers on it but the client is not supposed to know the names of the people working on it – yeah, I know. We have 2 git repositories. One of our client, and one where everyone is working on.

So my current workflow is to have separate folders for each repo. Whenever our QA says "Okay, new version is fine to send." I copy the source-folder from the "working repo" to the "client repo" and make a single commit, push and done. So far so good. But definitely plenty of room for improvement.

I was wondering if I could have the master branch to automatically change the history by obfuscating author names with a hook after the merge (or before the push) so that I could then, just git merge release inside of master and then git push with master having a different origin.

Is this possible?

(I know this seems weird, but… agencies, paranoia whatevs… I gave up)

nocksock
  • 5,369
  • 6
  • 38
  • 63

1 Answers1

1

You can definitely have two remotes (not origins). Let me call the one you are working on origin and the second one agencies.

Assuming that you already have origin configured, you add a second one with

git remote add agencies http://agencies.org/crazy-repo.git

If I understand correctly, there should be only one master branch in the agencies repository and it should contain only one commit per release with all the work that has been done in the iteration.

IMO, you should maintain a local branch for that purpose which you will update on every release. Let's do it.

$ git fetch agencies
$ git branch paranoia agencies/master
Branch paranoia set up to track remote branch master from agencies.

After iteration, you should create a realease commit (and possibly tag it with the new version). This will help you find what has been already released to agencies and what is new.

git comiit -m "Release of the next public version" --allow-empty
git push origin master

Then, you need to update your paranoia branch with new changes in the iteration.

git checkout paranoia
git cherry-pick <commit-hash-or-tag-of-previous-release>..master
git reset --soft agencies/master
git add -A
git commit -m "This is all the work in the past iteration, authored by me!"
git push

You can create a git alias for automating it.

fracz
  • 20,536
  • 18
  • 103
  • 149
  • This is definitely a possible solution! Do you know whether it's possible to, instead of having a single commit for all the work that's been done, keep the commits - but obfuscate the author names? But only for the agencies remote and paranoia branch. – nocksock Nov 01 '16 at 21:59
  • 1
    Absolutely. Instead of squashing the commits (the `git reset` part), you need to use `filter-branch` to change authors of all the commits from the previous release up to now ([you should find this interesting](http://stackoverflow.com/questions/750172/change-the-author-and-committer-name-and-e-mail-of-multiple-commits-in-git)). It will not change the "original" commits in `master` because the `cherry-pick` copies them. You may notice that by inspecting the hashes of commits in `master` and `paranoia` - they will be different. – fracz Nov 01 '16 at 22:03
  • That's perfect! Consider yourself my hero for the day. :) – nocksock Nov 02 '16 at 15:23