Bitbucket check if PR merge can happen automatically? - bitbucket

Can bitbucket (like github) detect if a PR's branch can be merged automatically with the base branch

Related

How I can Merge an already Merged Rull Request to different branch - without bringing other changes of that branch

My Pull Request in the Bitbucket is already merged to Dev Branch:
I created another branch and need to Merge only this PR to that branch how I can do this?
I only need changes on this PR, do not need all other changes that are in the Dev branch.

Bamboo build tying to undesired BitBucket Commit

Context
I have a BitBucket repo and a Bamboo Plan. The Bamboo Plan is tied to the Bitbucket repo in the "Repository" settings.
The Bamboo Plan "Branch" settings are set to create a new Branch when a new branch is created in the repo.
Issue
When I create a branch, bamboo makes a new branch and starts the build. The first build is tied to the latest commit which came from the original branch. I don't want to associate the new branch build with a commit to the original branch. (It causes more than one build to be associated with the commit.)
Desired Outcome
The build should only tie to new commits in the branch.
Solutions
Pull Request Trigger
I modified my bamboo plan to only trigger new bamboo branches when a Pull Request is created for the repo branch. It did give me the desired outcome. The downside is that commits to the branch will not be executed against the CICD process until a PR is created.
Is there a way to create Bamboo branches only on the first commit to a new repo branch?
No.
I'm sorry there isn't much you can do about this.

Restore merged branch in bitbucket

Long back I have created a pull request to merge my branch into master and it was done. I think the merged branches will not be available on Bitbucket for longer time? (Anyway, my branch is not available).
But, is there a way to recover that branch in Bitbucket?
I know how to recover it on git/sourcetree, but I want in Bitbucket to create another branch from this.
I have used this command to recover my branch to sourcetree,
git checkout -b <branch> <sha>
Created a tag from last commit of my branch and created branch from that tag.

how to pull changes from master branch into another branch (this branch created from master previously) in the root in git-tfs

I have two branch in git-tfs. one is master and other is QA, this branch is created from master previously. All the recent changes are in master. Now i want to get the changes from master to my QA branch. how to get that? I want to get done that from the browser.
If you are talking the git-tfs command tool, you could also manager merges with git-tfs.
If you want, for example, to merge the branch b1 in the trunk
trunk, you need that b1 and trunk to be entirely checked in
Tfs. Once done, you could do the merge with git as a normal merge
with 2 local git branches. Then you have to check this commit into
Tfs with the command rcheckin and a merge changeset will be created
into Tfs.
More details please refer this tutorial git-tfs ,but it's not able to do this from the browser.
If you are just talking about the GIT source control in TFS, and want to get done that from the browser. The only way is creating a pull request. Detail step just follow this thread: Create a pull request
You will just have to synchronise the branch with the master and it will do, i.e in easier terms synchronisation of a branch means to merge the master into that branch. That's it!

What does PR merge means?

In Jenkins what this both will do if I mention Branch Specifier as
1 origin/pr/${pullRequestId}/from
2 origin/pr/${pullRequestId}/merge
Does this means that in first case build will be created from what ever code will be there in the pull request. and in second case, changes in PR will be applied as a patch to the target branch locally,inside Jenkins workspace and build will be trigged on the same.
Can you confirm you are using Atlassian Stash to manage your Git repo?
When you create the PR, Stash try a "lazy" merge (in the /merge refs ID). If the target branch is moving, Stash will attempt new merges.
Some explanation about this lazy merge here.
If you trigger a Jenkins build with a Stash hook, Stash will send all the PR information to Jenkins (pullRequestId, from SHA1, merge SHA1, ...).
So with your Jenkins job, you can try a merge (origin/pr/${pullRequestId}/from to origin/master, if master is your target branch) and you can build the merge result.
This what we are doing in my company with these settings and the Stash pullrequest builder plugin:
It's working well :)
Every time a developer updates the PR, a new PR build is triggered and Jenkins tries to do a new merge.
Once the PR is validated, if the developer click on the Merge button, it'll try to merge the code on the target branch.
You can set some merge options in this properties file.

Resources