View previous topic :: View next topic |
Author |
Message |
John R. Graham Administrator
Joined: 08 Mar 2005 Posts: 10693 Location: Somewhere over Atlanta, Georgia
|
Posted: Thu Jan 16, 2025 3:24 pm Post subject: Git Workflow Question: Getting Ready for a Pull Request |
|
|
I think this is a fairly normal workflow. I've done the following:- Check out "master".
- Create a feature branch. Call it "feature".
- Work on the feature branch, committing early an often with various temporary changes, debug chatter, and generally being very verbose about my reasoning, false starts, and so forth.
- If other work is being done on master (not by me), merge and rebase as appropriate to keep my feature branch reasonably up to date with master.
Now I'm ready to submit my feature to upstream, but all of this commit chatter is meaningless to anyone but me. I also want to preserve the debug code, that I won't be submitting upstream, for my own benefit for future development on the feature branch. So what I want to do is:
- Create a "release-candidate" branch from the current HEAD of the "feature" branch.
- Edit out all of the extraneous debug chatter in the code and commit the clean code on the new branch with appropriate explanatory comments.
- Do something so that the "release-candidate" branch is attached to the HEAD of master so that only the commits I want to be part of the pull request are in that branch.
It's that last step that I don't know how to do. Some pointers would be appreciated.
- John _________________ I can confirm that I have received between 0 and 499 National Security Letters. |
|
Back to top |
|
|
logrusx Advocate
Joined: 22 Feb 2018 Posts: 2613
|
Posted: Thu Jan 16, 2025 4:38 pm Post subject: Re: Git Workflow Question: Getting Ready for a Pull Request |
|
|
John R. Graham wrote: |
- Do something so that the "release-candidate" branch is attached to the HEAD of master so that only the commits I want to be part of the pull request are in that branch.
It's that last step that I don't know how to do. Some pointers would be appreciated.
- John |
Create a patch and apply it to a new branch of master. Create the pull request from it.
Another option is to create a commit from a list of commits which would look to the outside world as a single commit and the verbosity of your previous commits will be hidden. I recently read about it wrt another issue but I don't remember how this feature was called.
EDIT: it's squashing. https://www.git-tower.com/learn/git/faq/git-squash
Best Regards,
Georgi |
|
Back to top |
|
|
pingtoo Veteran
Joined: 10 Sep 2021 Posts: 1402 Location: Richmond Hill, Canada
|
Posted: Thu Jan 16, 2025 5:12 pm Post subject: Re: Git Workflow Question: Getting Ready for a Pull Request |
|
|
logrusx wrote: | Create a patch and apply it to a new branch of master. Create the pull request from it. |
Isn't "pull request" is concept of github/gitlab/...?
I think git workflow does not have concept "pull request". |
|
Back to top |
|
|
logrusx Advocate
Joined: 22 Feb 2018 Posts: 2613
|
Posted: Thu Jan 16, 2025 5:40 pm Post subject: Re: Git Workflow Question: Getting Ready for a Pull Request |
|
|
pingtoo wrote: | logrusx wrote: | Create a patch and apply it to a new branch of master. Create the pull request from it. |
Isn't "pull request" is concept of github/gitlab/...?
I think git workflow does not have concept "pull request". |
It isn't, but it isn't git concept either. However it's also not relevant here as OP wants to use GitHub. To my knowledge, this is the way to incorporate changes in the main tree without you being a developer with rights to commit into Gentoo's git.
Best Regards,
Georgi |
|
Back to top |
|
|
pingtoo Veteran
Joined: 10 Sep 2021 Posts: 1402 Location: Richmond Hill, Canada
|
Posted: Thu Jan 16, 2025 6:12 pm Post subject: Re: Git Workflow Question: Getting Ready for a Pull Request |
|
|
logrusx wrote: | pingtoo wrote: | logrusx wrote: | Create a patch and apply it to a new branch of master. Create the pull request from it. |
Isn't "pull request" is concept of github/gitlab/...?
I think git workflow does not have concept "pull request". |
It isn't, but it isn't git concept either. However it's also not relevant here as OP wants to use GitHub. To my knowledge, this is the way to incorporate changes in the main tree without you being a developer with rights to commit into Gentoo's git.
Best Regards,
Georgi | Thank you very much.
I just found that usually when I search git workflow there is no mention "pull request". whereas when search for github workflow there is "pull request" however there is no "merge" concept.
I understand pull request underlying is still merge, just at the beginning when I learning git and subsequently learning github it is confusing when I try find how to merge my local repository into my main repository there seems no mention on how to "merge" on github. |
|
Back to top |
|
|
keekkenen n00b
Joined: 05 Oct 2024 Posts: 29
|
Posted: Thu Jan 16, 2025 6:12 pm Post subject: Re: Git Workflow Question: Getting Ready for a Pull Request |
|
|
John R. Graham wrote: | If other work is being done on master (not by me), merge and rebase as appropriate to keep my feature branch reasonably up to date with master. |
I think you need to make a merge only and maybe resolve the merge conflict if you and other one make changes in the same file.
John R. Graham wrote: | I also want to preserve the debug code, that I won't be submitting upstream, for my own benefit for future development on the feature branch. |
You need to make commits only releasing code (I mean debugged code must be stayed not committed).
And then you can make a stash, its operation to save you uncommitted (code for debug) code and delete it from the code of your feature (course, of all your code must be added to git index, I mean `git add {some files}`). After that, you need to push your feature code to the remote git repo, and you can make a pull (or merge) request in your platform (GitHub, GitLab, Bitbucket, etc). Also, you can make a new branch (aka release-candidate) from your feature branch, and then push it to remote repo and then make PR from its branch, but it's no sense (I mean it's excess action), but you can do this, it depends on your workflow process.
You can make git unstash operation in your feature branch and continue to debugging it. _________________ 7950x3d / x670e MSI Tomagawk / Sapphire RX 7800XT 16Gb / G.Skill 64Gb 5600 / A-Data Legend 960 2Tb (x2), A-Data SX8200PNP 256Gb |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|