Bitbucket commits page - greyed out/faded out commits? - bitbucket

In bitbucket when I go to the 'commits' page to see my list of commits for a branch, I see that some commits are full brightness, but others are faded/greyed out. What is the meaning behind this?
I've seen one other answer regarding this on the entire internet (no mention in official Atlassan documentation), but the answer was confusing.

These commits are likely merge commits, where BitBucket looks for a specific format in the commit comment:
This behavior is based on the commit comment. It must contain following lines:
Conflicts:
src/app.cpp
If bitbucket detects this pattern in the commit comment, the merge commit will be highlighted in commits view. Otherwise, it will appear as greyed-out.
Source: bitbucket web: highlighted or greyed-out merge commits?

Related

Is it possible to delete a pull-request on BitBucket?

I cannot find an option to delete a PR on BitBucket.
Am I overlooking something or it's really not possible?
You can decline a pull request which has the same result -- stopping / removing the PR.
As per the link jonrsharpe mentioned, to the right of the merge button there are 3 dots. Under that menu you should have a delete option if you have permission to delete.
This is available only for BitBucket Server, not on BitBucket.org.
In BitBucket.org there is no option to delete the PR.
For Bitbucket Cloud, there are no way to do this. One way of getting by is to have a 'dev/junk' branch, used for declined or useless pull requests.
Then just edit the existing request to go into this branch and merge.
Data is still there, in case you need it some day, or if it's sensitive info you can remove the whole branch. If its already declined before, well, nothing can be done then other than recreating that repo
See https://jira.atlassian.com/browse/BCLOUD-8089 for the update on this feature request and vote on it!
I wanted to delete a pull request of a branch that had already been merged and deleted. Even though I am an admin of my project, I cannot see any "delete" options. For me what worked was to recreate the deleted branch from the main branch and push it. E.g.
git checkout master
git checkout -b [deleted branch name]
git push -u origin [deleted branch name]
Then I opened Bitbucket and the branch showed up as "merged" and disappeared from the PRs list.
You cannot delete the PR in bitbucket.org .
Using Decline option will do exactly what you want - the PR won't be visible in the tab Pull requests (you need to sort PR by Decline to see it) but on tab Branches you will see that in column Pull request you have removed your problematic PR.
PS you cannot undo Decline of PR, so take care

What does the git commit --squash option do and why would it be useful?

I've been looking for an alternative solution for squashing a series of commits in a branch. What I've done in the past is to use git rebase -i HEAD~<#commits> and then chose which commits to squash. Typically I picked the latest commit, and squashed redundant commits in between.
This approach works reasonably well, but I was hoping for a faster way. I noticed that there is a --squash option for git commit. But I'm not sure how this works. What does it do exactly, and how do you use it? Would this be a solution for my problem?
From the documentation:
--squash=<commit>
Construct a commit message for use with rebase --autosquash. The commit message subject line is taken from the specified commit with a prefix of "squash! ". Can be used with
additional commit message options (-m/-c/-C/-F). See git-rebase[1] for
details.
--squash (also the --fixup flags) takes a commit as an argument, and formats the message for use with --autosquash.
It's possible to set rebase.autosquash = true in your config to make the whole process shorter.
If you want to squash your last N commits:
git reset --soft HEAD~N && git commit
This will put the head on HEAD~N, so index and the working directory will not be altered at all, meaning that you can now use git commit and create a single commit for all the changes.
Consider you are working on feature branch where you have done say 15 commits. Now you are done with the task and want to merge it master. These 15 commits will make history of master branch long, better option is to squash them in single commit , give it meaningfull comment. Master history is clean and good for you also to review in future.
Git merge master --sqash.
Now IDE also provide very good support for this option.

How to add descption to a given patchset in Gerrit?

I can create new patchset to a given Gerrit without issues.
However, I would like to describe what the patchset is about. I have been doing that as part of the commit message, as I commit -amend and push the new patchset with the revised comment.
Is there a well defined way of describing the patchset in the commit message, so Gerrit can automatically set its description? The only mentioning of the description I found so far was from this page:
https://gerrit-review.googlesource.com/Documentation/concept-patch-sets.html#_description
Heh, looks like I found a potential answer for my own question. :)
If I encode the push command with a %m= I seem to be able to set the description for the patchset. It feels a little hacky, in that I need to replace
spaces with _ and percent encode characters as well.
That is described gerrit's documentation for code review.
Example:
git push ssh://john.doe#git.example.com:29418/kernel/common HEAD:refs/for/experimental%m=This_is_a_rebase_on_master%21
Any other/better way that you may know about?

Bitbucket: Merge pull request without clicking Approve

I already merged a pull request in bitbucket. Can you all explain what is the difference between click Approve and don't click it?
Because I see that the merge commit still appears in git history/log even that I don't click Approve.
If your team has a Premium plan, repository admins can prevent pull requests that don't have a certain number of approvals from merging.
Other than that, it is a visual check only that the merge request was reviewed and approved prior to merging.
See: https://confluence.atlassian.com/bitbucket/pull-requests-and-code-review-223220593.html

Gerrit: is require change-id and merge as necessary incompatible?

I have a training Gerrit box running:
change id required
strategy = merge as required
commit-msg hook installed and working
Regular commits work just fine, but after a merge commit made by Gerrit, pushes fail as the merge commit has no change ID
Asking around I've heard most people say they have strategy = rebase as necessary.
A similar question (Why does Gerrit not include the change-id into merge commits?) has a work around for the same issue using another hook.
My conclusion then is that merge as necessary and change-id required are incompatible but I can't find any confirmation of this

Resources