0

Currently, I want to contribute to OpenStack and I am new to Gerrit. In Gerrit, I created a new branch my_branch but actually my code is very huge. Please kindly let me know how I can split my code to smaller changes with the same branch my_branch.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • 2
    Possible duplicate of [How to split last commit into two in Git](http://stackoverflow.com/questions/1440050/how-to-split-last-commit-into-two-in-git) – eush77 Jul 29 '16 at 06:11
  • It looks like different.. I'm sorry for making you confused. I changed my title. I means I just had a huge code in my local repository, no patch in Gerrit existed before. Now I want to split my code to several parts so that I can commit them with some corresponding changes. But I want the branch "my_branch" to be same with these changes. Is it clear to you? – Shayne Jonas Jul 29 '16 at 06:28
  • Yes, that's exactly the same. Has nothing to do with Gerrit, can all be done on the Git level. – StephenKing Jul 29 '16 at 07:03
  • Totally agree. But when I saw in the accepted answer, someone wants to split a file. My question is if I have several files .py like file1.py, file2.py,..., file5.py. Now I want to combine (file1.py & file2.py) in one change, (file3.py, file4.py and file5.py) in another change. Two changes are the sane branch. How can I do it? – Shayne Jonas Jul 29 '16 at 07:43
  • It depends on your code and where you want to contribute it to (which repository exactly). This has nothing to do with gerrit, though, it's a general git question. Show us your code. – Stefano Maffulli Jul 29 '16 at 23:10
  • So have you commited anything? Did you make a single, big commit that you want to split, or do you have several commits that you want to rearrange? – Dunno Aug 02 '16 at 14:25
  • @Dunno: Absolutely No. I just have some code. And now I have intention to separate them into several parts. And then i will commit these parts. – Shayne Jonas Aug 02 '16 at 19:06

1 Answers1

-1

Pleaas tray git gui tools - citool, gitk.

git citool gives possibility to choose which files and even which lines you put in new commit.

Very useful maybe also gitk command which show your commits tree. gitk gives also posibility to run some other git comman from gui.

Slawomir Jaranowski
  • 7,381
  • 3
  • 25
  • 33