简体   繁体   中英

Pulling from one Git repo and pushing to another

Basically, there are remote 2 repositories: lets call one private another company . On private multiple people are actively working.

What I want to achieve is, when pushing to the company repo, not to include commit history with other people's name and push as one bunch of changes from one name.

Is there any easy way to achieve this using one local repository?

Currently, when I do,

git pull private main
git push company main

It copies whole commit history.

Push only pushes existing commits and their complete history. It will not change commits. Make a local branch. Sculpt it as you like . Push that.

However , be wary of taking credit for other people's work. Git has a mechanism to account for this. Each commit records both an author and a committer. You can see both with git log --format=fuller . Usually these are the same, the author of the change is the same as who made the commit. Sometimes they are not, as when a patch is mailed to a maintainer. The author is who submitted the patch, the committer is the maintainer who made the commit.

Consider using this mechanism instead. Retain the author, but make yourself the committer.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM