nocksock
nocksock

Reputation: 5527

automatically change author names in specific branch with git hooks

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)

Upvotes: 0

Views: 365

Answers (1)

fracz
fracz

Reputation: 21249

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.

Upvotes: 1

Related Questions