Reputation: 51
I'm working on a project on clients repository and now I want to add another developer without the client knowing it.
I've tried to set up new repository add it as remote in my machine then pull from alternative (where the other developer commits) & push to origin (clients repo), but even as the other developer don't have any access to clients repo the commits there shows as his.
How should I avoid this and push his commits to clients repo as mine?
e.g.
Developer makes changes to file1 and commits it to repo2
I pull from the repo2 inspect the code & push it to repo1
In repo2 it shows that the file1 is changed & commit is made by Developer
I need that it would show that file1 is changed & commit is made by me under repo 1
Upvotes: 2
Views: 183
Reputation: 6476
Git allows you to specify author:
git commit ... [--author=<author>]
Make Developer use your name and your requirements will be fulfilled.
Example:
$ git init
Initialized empty Git repository in c:/projects/bb/.git/
$ touch a
$ git add a
$ git commit -m "new file" --author="Author Name <[email protected]>"
[master (root-commit) cb6ca75] new file
Author: Author Name <[email protected]>
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 a
$ git log
commit cb6ca75753e13de07202f131d730c68df1a96941
Author: Author Name <[email protected]>
Date: Thu Aug 13 12:24:21 2015 +0300
new file
In case to be sure that Developer will commit changes on behalf of Author Name <[email protected]>
you can add an alias:
git config --local alias.com 'commit --author="Author Name <[email protected]>"'
and then use it
$ touch file2
$ git add file2
$ git com -m "File2"
[master ed88a10] File2
Author: Author Name <[email protected]>
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 file2
$ git log
commit ed88a10d1e1fef95cebd7d9cbc028314e6a3fa54
Author: Author Name <[email protected]>
Date: Thu Aug 13 12:46:48 2015 +0300
File2
commit cb6ca75753e13de07202f131d730c68df1a96941
Author: Author Name <[email protected]>
Date: Thu Aug 13 12:24:21 2015 +0300
new file
Upvotes: 2