Now I have several commits and one commit has been +2 in Gerrit, I want to merge it, but don't know how to achieve it.
I work in a scrum team and the master requires us do not combine multiple commits to one, so must merge one by one
my commits is like this:
Commit 6
Commit 5
Commit 4
Commit 3
Commit 2
Commit 1
the commit 2 has been +2 in the commit, I want to merge it, how can I do this?
Related
In my company we have the following workflow: development is done on a dev branch, once author wants to merge the changes he/she squashes the changes and create a Pull Request. If during the review turns out the rework is needed then the author adds new commits to the branch. Once everything is approved the author should squash commits and rebase the code (if needed). Then the maintainer merges the branch to the master branch, which results in one commit only to be added (plus the merge commit). This is to keep the log neat.
However occasionally the maintainer overlooks the fact the commits on the dev branch weren't squashed which results in multiple "work in progress" commits to be included in the master branch. We want to avoid the situation. The question is how to do that?
I was looking through Pull Request "merge check" plugins that could e.g. disable "Merge" button if there is more than 1 commit between source and destination branches, but so far I haven't found any.
I know we could enable automatic squashing on merge but we decided not to squash automatically. We feel it's better for us if the squash is done manually by the developer, e.g. commit message may be corrected accordingly.
Correcting the history in the master branch is also not possible due to our policy forbidding rewriting history on that branch.
We're using Gerrit. We thought we could do the following:
create some commits on a topic branch:
- a
- b
- c
Push those commits to gerrit.
Get some reviews.
Have Jenkins build only the last commit of the bunch.
Unfortunately, it looks like gerrit internally creates three different branches for those three commits, and when we have Jenkins run the script to build the topic, it winds up picking a different commit than the one we intended. Is there someway to get the behavior we desire?
You can change the project configuration to only create one review for your series of changes. This can be done by setting the Create a new change for every commit not in the target branch to false
Biggest disadvantage is that you can't review what has been changed in the changesets leading up to the latest change.
See the Gerrit Documentation
Gerrit always creates one change (review) for each commit pushed. There's no way to create one unique change for a bunch of commits. Commits are stored in special branches (like, for example, refs/changes/12/40312/1) until they aren't submitted (merged in the final branch).
You can, of course, build several commits at once after they are submitted to the branch but you only can trigger Jenkins to start a build every time some commit is merged in the branch (one build for each commit). If you want to have just one build for a bunch of commits you could consider to make scheduled builds started automatically some time of the day (night builds).
I would ask you if you have some experiences with merge by tf.exe. I have two branches - branch 1 and child branch branch 2 created from branch 1. I have some changesets in branch 2 and I want to merge it to branch 1 (reverse integration). I merge it by tf.exe (my external tool call it). Then I want to show merge candidate from branch 1 to branch 2 (forward integration) and there are changesets created by previous merge from branch 2 to branch 1.
I compare branch 2 and branch 1 after merge from branch 2 to branch 1 and there are no differences. But I have still changesets in branch 1 which want to merge brachn 2. When I would merge these changesets from branch 1 to branch 2 (forward) then there are conflicts in resx files.
When I merge these changesets from branch 2 to branch 1 by Visual Studio there are not changesets to merge from branch 1 to branch 2.
What is different? I use my external merge tool because of create some reports of merged changesets and some reason of planning and releasing.
I found some related topics but there was about renaming of branches. But I have stable naming branches. Problem is when I do forward integration because this changesets do problems in merge.
I checked in commit 100 last night on our trunk. Another developer checked in commit 101 this afternoon on the trunk. I wished for him to create a branch instead. What is the easiest way to revert the trunk back to 100 and to create a new branch that contains 101?
Create the branch now from 101. Once the new branch exists use the rollback command to undo 101 in trunk.
If you are using TFS 2012 you just need to view history of trunk and then highlight checkin 101 and select rollback complete changeset. Checkin the rollback, this will be checkin 102.
You may have problems when you come to merge the new branch back to trunk, if TFS thinks the rollback takes precedence (because its more recent) then use a visual studio command line to do the merge and use tf merge $/teamproject/devbranch $/teamproject/trunk /recursive /force
Let's suppose that I have three branches:
Main
+--Dev
+--Release
And several changesets in Dev: changeset 1, 2 and 3 and all three changesets affect some File. At some point I merge them all into Main and get changeset 4, that includes changes from all three changesets.
What should I do if at this point I have to merge changeset 2 also into Release branch? If I try to merge from Main into Release I'll have to merge changeset 4 and then manually include only necessary edits made on File. But in this case after checkin, TFS will mark whole changeset 4 as merged and will not offer it later for merge, despite the fact that changes from changeset 1 and 3 were not included.
I know I could have avoided this situation by merging each changeset from Dev into Main separately, but that's very tedious and doesn't seem like a right way.
I could also use baseless merge and go directly from Dev into Release, but that's something I consider to be an extreme measure.
Are there any other ways?
Sounds like you need feature branches. You could then just merge change set 2 into release. You can still do this after rebasing or cherry-picking change set 2 off of the common ancestor into a feature branch.
Git-tfs will help you do this.
Hope this helps