Git: How do I reload all the commits of one specific author into a separate branch?

I use code that does not use SCM + and receive periodic updates in the form of all project files, although only some of them have been changed only a little. So far, I just made my changes to the git repository and resolved these “updates” using the git add -p manual session, which is becoming more and more annoying with the volume of my own changes (those that are not yet defined), and, fortunately, I made a git commit --author "the others" for the above "patches", I would like to know:

How will all commits made by one author be split into a new branch?

(I do not mind rewriting the story in this case, the repo is only used by me)

An ideal solution would be to merge another branch into the mine after each “patch”, but for now, the final merge at the end may be sufficient.


+ yes, the Jedi really felt like you cringed there

+8
git git-rebase version-control branch
source share
2 answers

I recently did this for someone:

 git checkout -b other_work <sha1_of_where_to_rebase> git log --reverse --author=others --format=%H <sha1_range> | xargs -n 1 git cherry-pick 

Hope this helps

+6
source share

I don’t quite understand what you are doing, but the problem that you are describing with a third-party code base is called the “provider branch”. Here's how I would handle it:

Make a branch for a third-party version, for example. vendor . I assume your branch is called master . When they publish a new version, you can do the following:

 git stash # If you have any uncommitted files git checkout vendor tar -xzvf [new files] # This might be unzip or whatever, rather than tar git commit -am "Version xxx from upstream" # Adjust commit message to suit git checkout master git merge vendor # Bring changes into your branch (you could use rebase here if you prefer to keep all your changes on top of all their changes) git stash pop # Restore your uncommitted files 

ps. not git add -p , I would use git gui . I was skeptical about using gui for starters, but now I couldn't live without git gui and gitk (or gitx on mac).

+2
source share

All Articles