Git - cleaning repo

I have my repo in a bit of a state and want me to have a way out of it.

The repo looks something like this (A1, B1, C1, etc. obviously commit)

A1 ---- A2 ---- A3 ---- A4 ---- A5 ---- A6 ---- A7 ---- A8 / (from a remote repo) B1 ---- B2 --------------------------------- | \ \ C1 ---------------------------------C2 \ / D1 --- D2 --- D3 --- D4 --- D5 --- D6 

Ideally, I would like to delete all versions (with rebase?) In lines B, C and D (I hate talking branches simply because there are no local branches in these lines except ref branches to the remote repo) and try to merge again in the remote repo perhaps at its best.

I would appreciate any suggestions on how to get rid of all these commits. May I ask that any answers use SHA1 revisions, not branch names. I thought that somehow I could return the merger to A7, but I can’t figure out how to do it.

I hope this is enough information. Many thanks

Simon

+4
source share
3 answers

Okay, I guess you mean linearizing the changes.

You should be able to do something like:

 git rebase AB git rebase 'AC git rebase ''AD 

ABC and D are commit / ref related to reboot. In fact, passing ABC and / or D to reinstall is likely to do nothing . You should do something like this:

 git rebase master branchname 

Does it help?

+1
source

Rebasing branches most likely you want to do as xyld suggested.

Before you do this, I would recommend reading the rebase command from chapter 3 of the Pro Git book . This should help explain how this process works, and get what you need to know about. (For example, you should never reinstall the commits that you have already clicked on to the public repository, or this will ruin them for everyone else ... but this is not like this.)

+1
source

When i do

 git rebase -f 557b29ecc0ec c96769ef2f 

This is obviously doing rebase. However he reports

 Falling back to patching base and 3-way merge... error: Your local changes to 'Client/WebDataEntry/temp.txt' would be overwritten by merge. Aborting. Failed to merge in the changes. Patch failed at 0004 Initial Source Load 

I previously added / corrected any changes, so I don’t know why he should report it, except for some cyclical situation or a situation in which he cannot resolve the conflict automatically, since it ends with

 When you have resolved this problem run "git rebase --continue". If you would prefer to skip this patch, instead run "git rebase --skip". To restore the original branch and stop rebasing run "git rebase --abort". 

So I'm trying to run rebase interactively

 git rebase -i 557b29ecc0ec c96769ef2f 

but i get an error

 Invalid branchname: c96769ef2f 

I must add that it is entirely possible that my thinking / understanding is wrong. I was hoping that since there is no common ancestor between A1 and B1, if I reinstall B1 (or any subsequent commit) to A1, it will effectively remove the B1 / C1 / D1 lines.

thanks again

0
source

Source: https://habr.com/ru/post/1308995/


All Articles