Bitbucket: Send a pull request via command line?
I have to send a lot of pull requests, so I would rather use the bash command line than bitbucket's web interface.
Usage example: $ git-req username
Here is such a script for Github: http://pastebin.com/F9n3nPuu
Is there one for Bitbucket?
command-line bitbucket pull-request
add a comment |
I have to send a lot of pull requests, so I would rather use the bash command line than bitbucket's web interface.
Usage example: $ git-req username
Here is such a script for Github: http://pastebin.com/F9n3nPuu
Is there one for Bitbucket?
command-line bitbucket pull-request
add a comment |
I have to send a lot of pull requests, so I would rather use the bash command line than bitbucket's web interface.
Usage example: $ git-req username
Here is such a script for Github: http://pastebin.com/F9n3nPuu
Is there one for Bitbucket?
command-line bitbucket pull-request
I have to send a lot of pull requests, so I would rather use the bash command line than bitbucket's web interface.
Usage example: $ git-req username
Here is such a script for Github: http://pastebin.com/F9n3nPuu
Is there one for Bitbucket?
command-line bitbucket pull-request
command-line bitbucket pull-request
asked Jan 4 '12 at 3:37
Nicolas RaoulNicolas Raoul
34k46161290
34k46161290
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
Bitbucket with it's RESTful API 2.0 supports managing pull requests without interface. In CLI you can request it with CURL. This older version of the documentation has better interface details.
Get pull request data with CURL
To get full data about specific pull request:
$ curl --user s3m3n:bbpassword https://bitbucket.org/api/2.0/repositories/s3m3n/reponame/pullrequests/4
In return I get JSON with full info about my pull request #4 (put your username twice, password and reponame in command).
Create new pull request with RESTClient
To create new pull request we need to provide a lot of data with POST command, below how it looks in my RESTClient:
After firing Bitbucket shows pull request immediately:
Create new pull request with CURL
You can still create the same pull request with one liner:
$ curl -X POST -H "Content-Type: application/json" -u s3m3n:bbpassword https://bitbucket.org/api/2.0/repositories/s3m3n/reponame/pullrequests -d '{ "title": "Merge some branches", "description": "stackoverflow example", "source": { "branch": { "name": "choose branch to merge with" }, "repository": { "full_name": "s3m3n/reponame" } }, "destination": { "branch": { "name": "choose branch that is getting changes" } }, "reviewers": [ { "username": "some other user needed to review changes" } ], "close_source_branch": false }'
REST browser tool (discontinued)
If you want to test all possible methods of API hop to REST browser tool of Bitbucket. It will show you all possible requests while returning your real repo's data.
+1 Great progress! I am sure an easy-to-use command-line client will appear soon.
– Nicolas Raoul
Dec 18 '13 at 6:06
What do you expect from such client? One line CURL to create new pull request is pretty simple, all trouble is json as POST body, but you have to pass all data somehow. How would you like to do that in other way?
– s3m3n
Dec 18 '13 at 11:42
I would at least create an alias for the simple casegit-req username
.
– Nicolas Raoul
Dec 18 '13 at 11:46
Sadly, the REST browser tool appears to have been discontinued.
– myrcutio
Mar 3 '16 at 16:31
1
@Darktalker it's very interesting. It seems that the new documentation is pretty bad. Look how my link at the top of answer looked like year before in web.archive.org.
– s3m3n
Jul 28 '16 at 11:16
|
show 3 more comments
There are 2 repos on bitbucket that could help:
the Attlassian team have stash (ruby): https://bitbucket.org/atlassian/bitbucket-server-cli
Zhemao has bitbucket-cli (python): https://bitbucket.org/zhemao/bitbucket-cli
both have pull request feature from command line.
Looking at Zhemao, I don't see a way to do a pull request. Was this removed since you posted the answer?
– David Welch
Jul 25 '13 at 4:49
Any update on this CLI pull request for bitbucket?
– Autodidact
Nov 9 '13 at 8:36
@Millisami Came here through Google looking voor the same feature and Stash seems to have it now (don't know since when).
– Ivo Dancet
Dec 2 '13 at 16:48
Does this feature exists for not Stash, for Bitbucket?
– Autodidact
Dec 3 '13 at 5:51
2
@keen Zhemao/bitbucket-cli does provide thepull_request
command since 6c50435 but it is not documented in the readme.
– pylipp
Sep 20 '18 at 10:02
|
show 6 more comments
I wasn't too satisfied with the answers in this thread, so I created an package for it:
https://www.npmjs.com/package/bitbucket-pr
Instructions:
npm i -g bitbucket-pr
... Go to folder where you want to create a pull request ...
bitbucket-pr
Cool! How is it different from the others? What was not satisfying you?
– Nicolas Raoul
Feb 16 '18 at 13:16
The answer from karojosh doesn't have a proper solution, and the answer from s3m3n requires too much overhead. My package just opens the browser of the pull request with pre-filled information, which is probably the fastest way of doing it.
– Karamell
Feb 16 '18 at 13:20
Great tool! this saves me a few clicks! It will be possible to give as argument the destination branch?
– Ryan Amaral
Apr 28 '18 at 19:14
Nice that you find it useful. It will always go to the main branch of the repo, which you can change in the bitbucket settings. If you really want to have the target branch as an argument, you could do a pull request. The thing is like 5 lines of bash so should be easy to hack :)
– Karamell
May 10 '18 at 11:08
3
It would be great if you provide the source of your npm modules, that way, anyone can validate it's source code before using it, or even improving it
– Luis Lobo Borobia
Jun 15 '18 at 15:16
|
show 2 more comments
Tried and tested :
Generate personal access token by clicking here
Save the Unique token id, append it after "Bearer in header".
For example: "Authorization : Bearer MDg4MzA4NTcfhtrhthyt/Thyythyh "
Complete JSON sample here:
Step 1 to enter the details and necessary headers
Try running it
Step 2Output on BitBucket, You will be able to see the pull request
Final output
Command Line Syntax:
curl -i -X POST -H "Authorization:Bearer MDg4MzA4NTk/TlMSS6Ea" -H "X-Atlassian-Token:no-check" -H "Content-Type:application/json" -d '{"description":"1. Changes made 2. Changes made 3. Hello hanges","closed":false,"fromRef":{"id":"refs/heads/branch","repository":{"name":"From Repository ","project":{"key":"ProjectName"},"slug":"From Repository "}},"state":"OPEN","title":"Merge changes from branch to master","locked":false,"reviewers":,"open":true,"toRef":{"id":"refs/heads/master","repository":{"name":"RepoName","project":{"key":"ProjectName"},"slug":"RepoName"}}}' 'https://bitbucket.agile.com/rest/api/1.0/projects/projectName/repos/repoName/pull-requests'
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f8721730%2fbitbucket-send-a-pull-request-via-command-line%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
Bitbucket with it's RESTful API 2.0 supports managing pull requests without interface. In CLI you can request it with CURL. This older version of the documentation has better interface details.
Get pull request data with CURL
To get full data about specific pull request:
$ curl --user s3m3n:bbpassword https://bitbucket.org/api/2.0/repositories/s3m3n/reponame/pullrequests/4
In return I get JSON with full info about my pull request #4 (put your username twice, password and reponame in command).
Create new pull request with RESTClient
To create new pull request we need to provide a lot of data with POST command, below how it looks in my RESTClient:
After firing Bitbucket shows pull request immediately:
Create new pull request with CURL
You can still create the same pull request with one liner:
$ curl -X POST -H "Content-Type: application/json" -u s3m3n:bbpassword https://bitbucket.org/api/2.0/repositories/s3m3n/reponame/pullrequests -d '{ "title": "Merge some branches", "description": "stackoverflow example", "source": { "branch": { "name": "choose branch to merge with" }, "repository": { "full_name": "s3m3n/reponame" } }, "destination": { "branch": { "name": "choose branch that is getting changes" } }, "reviewers": [ { "username": "some other user needed to review changes" } ], "close_source_branch": false }'
REST browser tool (discontinued)
If you want to test all possible methods of API hop to REST browser tool of Bitbucket. It will show you all possible requests while returning your real repo's data.
+1 Great progress! I am sure an easy-to-use command-line client will appear soon.
– Nicolas Raoul
Dec 18 '13 at 6:06
What do you expect from such client? One line CURL to create new pull request is pretty simple, all trouble is json as POST body, but you have to pass all data somehow. How would you like to do that in other way?
– s3m3n
Dec 18 '13 at 11:42
I would at least create an alias for the simple casegit-req username
.
– Nicolas Raoul
Dec 18 '13 at 11:46
Sadly, the REST browser tool appears to have been discontinued.
– myrcutio
Mar 3 '16 at 16:31
1
@Darktalker it's very interesting. It seems that the new documentation is pretty bad. Look how my link at the top of answer looked like year before in web.archive.org.
– s3m3n
Jul 28 '16 at 11:16
|
show 3 more comments
Bitbucket with it's RESTful API 2.0 supports managing pull requests without interface. In CLI you can request it with CURL. This older version of the documentation has better interface details.
Get pull request data with CURL
To get full data about specific pull request:
$ curl --user s3m3n:bbpassword https://bitbucket.org/api/2.0/repositories/s3m3n/reponame/pullrequests/4
In return I get JSON with full info about my pull request #4 (put your username twice, password and reponame in command).
Create new pull request with RESTClient
To create new pull request we need to provide a lot of data with POST command, below how it looks in my RESTClient:
After firing Bitbucket shows pull request immediately:
Create new pull request with CURL
You can still create the same pull request with one liner:
$ curl -X POST -H "Content-Type: application/json" -u s3m3n:bbpassword https://bitbucket.org/api/2.0/repositories/s3m3n/reponame/pullrequests -d '{ "title": "Merge some branches", "description": "stackoverflow example", "source": { "branch": { "name": "choose branch to merge with" }, "repository": { "full_name": "s3m3n/reponame" } }, "destination": { "branch": { "name": "choose branch that is getting changes" } }, "reviewers": [ { "username": "some other user needed to review changes" } ], "close_source_branch": false }'
REST browser tool (discontinued)
If you want to test all possible methods of API hop to REST browser tool of Bitbucket. It will show you all possible requests while returning your real repo's data.
+1 Great progress! I am sure an easy-to-use command-line client will appear soon.
– Nicolas Raoul
Dec 18 '13 at 6:06
What do you expect from such client? One line CURL to create new pull request is pretty simple, all trouble is json as POST body, but you have to pass all data somehow. How would you like to do that in other way?
– s3m3n
Dec 18 '13 at 11:42
I would at least create an alias for the simple casegit-req username
.
– Nicolas Raoul
Dec 18 '13 at 11:46
Sadly, the REST browser tool appears to have been discontinued.
– myrcutio
Mar 3 '16 at 16:31
1
@Darktalker it's very interesting. It seems that the new documentation is pretty bad. Look how my link at the top of answer looked like year before in web.archive.org.
– s3m3n
Jul 28 '16 at 11:16
|
show 3 more comments
Bitbucket with it's RESTful API 2.0 supports managing pull requests without interface. In CLI you can request it with CURL. This older version of the documentation has better interface details.
Get pull request data with CURL
To get full data about specific pull request:
$ curl --user s3m3n:bbpassword https://bitbucket.org/api/2.0/repositories/s3m3n/reponame/pullrequests/4
In return I get JSON with full info about my pull request #4 (put your username twice, password and reponame in command).
Create new pull request with RESTClient
To create new pull request we need to provide a lot of data with POST command, below how it looks in my RESTClient:
After firing Bitbucket shows pull request immediately:
Create new pull request with CURL
You can still create the same pull request with one liner:
$ curl -X POST -H "Content-Type: application/json" -u s3m3n:bbpassword https://bitbucket.org/api/2.0/repositories/s3m3n/reponame/pullrequests -d '{ "title": "Merge some branches", "description": "stackoverflow example", "source": { "branch": { "name": "choose branch to merge with" }, "repository": { "full_name": "s3m3n/reponame" } }, "destination": { "branch": { "name": "choose branch that is getting changes" } }, "reviewers": [ { "username": "some other user needed to review changes" } ], "close_source_branch": false }'
REST browser tool (discontinued)
If you want to test all possible methods of API hop to REST browser tool of Bitbucket. It will show you all possible requests while returning your real repo's data.
Bitbucket with it's RESTful API 2.0 supports managing pull requests without interface. In CLI you can request it with CURL. This older version of the documentation has better interface details.
Get pull request data with CURL
To get full data about specific pull request:
$ curl --user s3m3n:bbpassword https://bitbucket.org/api/2.0/repositories/s3m3n/reponame/pullrequests/4
In return I get JSON with full info about my pull request #4 (put your username twice, password and reponame in command).
Create new pull request with RESTClient
To create new pull request we need to provide a lot of data with POST command, below how it looks in my RESTClient:
After firing Bitbucket shows pull request immediately:
Create new pull request with CURL
You can still create the same pull request with one liner:
$ curl -X POST -H "Content-Type: application/json" -u s3m3n:bbpassword https://bitbucket.org/api/2.0/repositories/s3m3n/reponame/pullrequests -d '{ "title": "Merge some branches", "description": "stackoverflow example", "source": { "branch": { "name": "choose branch to merge with" }, "repository": { "full_name": "s3m3n/reponame" } }, "destination": { "branch": { "name": "choose branch that is getting changes" } }, "reviewers": [ { "username": "some other user needed to review changes" } ], "close_source_branch": false }'
REST browser tool (discontinued)
If you want to test all possible methods of API hop to REST browser tool of Bitbucket. It will show you all possible requests while returning your real repo's data.
edited Oct 13 '16 at 6:39
keen
647710
647710
answered Dec 17 '13 at 18:51
s3m3ns3m3n
2,9942323
2,9942323
+1 Great progress! I am sure an easy-to-use command-line client will appear soon.
– Nicolas Raoul
Dec 18 '13 at 6:06
What do you expect from such client? One line CURL to create new pull request is pretty simple, all trouble is json as POST body, but you have to pass all data somehow. How would you like to do that in other way?
– s3m3n
Dec 18 '13 at 11:42
I would at least create an alias for the simple casegit-req username
.
– Nicolas Raoul
Dec 18 '13 at 11:46
Sadly, the REST browser tool appears to have been discontinued.
– myrcutio
Mar 3 '16 at 16:31
1
@Darktalker it's very interesting. It seems that the new documentation is pretty bad. Look how my link at the top of answer looked like year before in web.archive.org.
– s3m3n
Jul 28 '16 at 11:16
|
show 3 more comments
+1 Great progress! I am sure an easy-to-use command-line client will appear soon.
– Nicolas Raoul
Dec 18 '13 at 6:06
What do you expect from such client? One line CURL to create new pull request is pretty simple, all trouble is json as POST body, but you have to pass all data somehow. How would you like to do that in other way?
– s3m3n
Dec 18 '13 at 11:42
I would at least create an alias for the simple casegit-req username
.
– Nicolas Raoul
Dec 18 '13 at 11:46
Sadly, the REST browser tool appears to have been discontinued.
– myrcutio
Mar 3 '16 at 16:31
1
@Darktalker it's very interesting. It seems that the new documentation is pretty bad. Look how my link at the top of answer looked like year before in web.archive.org.
– s3m3n
Jul 28 '16 at 11:16
+1 Great progress! I am sure an easy-to-use command-line client will appear soon.
– Nicolas Raoul
Dec 18 '13 at 6:06
+1 Great progress! I am sure an easy-to-use command-line client will appear soon.
– Nicolas Raoul
Dec 18 '13 at 6:06
What do you expect from such client? One line CURL to create new pull request is pretty simple, all trouble is json as POST body, but you have to pass all data somehow. How would you like to do that in other way?
– s3m3n
Dec 18 '13 at 11:42
What do you expect from such client? One line CURL to create new pull request is pretty simple, all trouble is json as POST body, but you have to pass all data somehow. How would you like to do that in other way?
– s3m3n
Dec 18 '13 at 11:42
I would at least create an alias for the simple case
git-req username
.– Nicolas Raoul
Dec 18 '13 at 11:46
I would at least create an alias for the simple case
git-req username
.– Nicolas Raoul
Dec 18 '13 at 11:46
Sadly, the REST browser tool appears to have been discontinued.
– myrcutio
Mar 3 '16 at 16:31
Sadly, the REST browser tool appears to have been discontinued.
– myrcutio
Mar 3 '16 at 16:31
1
1
@Darktalker it's very interesting. It seems that the new documentation is pretty bad. Look how my link at the top of answer looked like year before in web.archive.org.
– s3m3n
Jul 28 '16 at 11:16
@Darktalker it's very interesting. It seems that the new documentation is pretty bad. Look how my link at the top of answer looked like year before in web.archive.org.
– s3m3n
Jul 28 '16 at 11:16
|
show 3 more comments
There are 2 repos on bitbucket that could help:
the Attlassian team have stash (ruby): https://bitbucket.org/atlassian/bitbucket-server-cli
Zhemao has bitbucket-cli (python): https://bitbucket.org/zhemao/bitbucket-cli
both have pull request feature from command line.
Looking at Zhemao, I don't see a way to do a pull request. Was this removed since you posted the answer?
– David Welch
Jul 25 '13 at 4:49
Any update on this CLI pull request for bitbucket?
– Autodidact
Nov 9 '13 at 8:36
@Millisami Came here through Google looking voor the same feature and Stash seems to have it now (don't know since when).
– Ivo Dancet
Dec 2 '13 at 16:48
Does this feature exists for not Stash, for Bitbucket?
– Autodidact
Dec 3 '13 at 5:51
2
@keen Zhemao/bitbucket-cli does provide thepull_request
command since 6c50435 but it is not documented in the readme.
– pylipp
Sep 20 '18 at 10:02
|
show 6 more comments
There are 2 repos on bitbucket that could help:
the Attlassian team have stash (ruby): https://bitbucket.org/atlassian/bitbucket-server-cli
Zhemao has bitbucket-cli (python): https://bitbucket.org/zhemao/bitbucket-cli
both have pull request feature from command line.
Looking at Zhemao, I don't see a way to do a pull request. Was this removed since you posted the answer?
– David Welch
Jul 25 '13 at 4:49
Any update on this CLI pull request for bitbucket?
– Autodidact
Nov 9 '13 at 8:36
@Millisami Came here through Google looking voor the same feature and Stash seems to have it now (don't know since when).
– Ivo Dancet
Dec 2 '13 at 16:48
Does this feature exists for not Stash, for Bitbucket?
– Autodidact
Dec 3 '13 at 5:51
2
@keen Zhemao/bitbucket-cli does provide thepull_request
command since 6c50435 but it is not documented in the readme.
– pylipp
Sep 20 '18 at 10:02
|
show 6 more comments
There are 2 repos on bitbucket that could help:
the Attlassian team have stash (ruby): https://bitbucket.org/atlassian/bitbucket-server-cli
Zhemao has bitbucket-cli (python): https://bitbucket.org/zhemao/bitbucket-cli
both have pull request feature from command line.
There are 2 repos on bitbucket that could help:
the Attlassian team have stash (ruby): https://bitbucket.org/atlassian/bitbucket-server-cli
Zhemao has bitbucket-cli (python): https://bitbucket.org/zhemao/bitbucket-cli
both have pull request feature from command line.
edited Nov 15 '17 at 7:59
itsadok
19.2k25104158
19.2k25104158
answered Feb 23 '13 at 23:29
karojoshkarojosh
3141513
3141513
Looking at Zhemao, I don't see a way to do a pull request. Was this removed since you posted the answer?
– David Welch
Jul 25 '13 at 4:49
Any update on this CLI pull request for bitbucket?
– Autodidact
Nov 9 '13 at 8:36
@Millisami Came here through Google looking voor the same feature and Stash seems to have it now (don't know since when).
– Ivo Dancet
Dec 2 '13 at 16:48
Does this feature exists for not Stash, for Bitbucket?
– Autodidact
Dec 3 '13 at 5:51
2
@keen Zhemao/bitbucket-cli does provide thepull_request
command since 6c50435 but it is not documented in the readme.
– pylipp
Sep 20 '18 at 10:02
|
show 6 more comments
Looking at Zhemao, I don't see a way to do a pull request. Was this removed since you posted the answer?
– David Welch
Jul 25 '13 at 4:49
Any update on this CLI pull request for bitbucket?
– Autodidact
Nov 9 '13 at 8:36
@Millisami Came here through Google looking voor the same feature and Stash seems to have it now (don't know since when).
– Ivo Dancet
Dec 2 '13 at 16:48
Does this feature exists for not Stash, for Bitbucket?
– Autodidact
Dec 3 '13 at 5:51
2
@keen Zhemao/bitbucket-cli does provide thepull_request
command since 6c50435 but it is not documented in the readme.
– pylipp
Sep 20 '18 at 10:02
Looking at Zhemao, I don't see a way to do a pull request. Was this removed since you posted the answer?
– David Welch
Jul 25 '13 at 4:49
Looking at Zhemao, I don't see a way to do a pull request. Was this removed since you posted the answer?
– David Welch
Jul 25 '13 at 4:49
Any update on this CLI pull request for bitbucket?
– Autodidact
Nov 9 '13 at 8:36
Any update on this CLI pull request for bitbucket?
– Autodidact
Nov 9 '13 at 8:36
@Millisami Came here through Google looking voor the same feature and Stash seems to have it now (don't know since when).
– Ivo Dancet
Dec 2 '13 at 16:48
@Millisami Came here through Google looking voor the same feature and Stash seems to have it now (don't know since when).
– Ivo Dancet
Dec 2 '13 at 16:48
Does this feature exists for not Stash, for Bitbucket?
– Autodidact
Dec 3 '13 at 5:51
Does this feature exists for not Stash, for Bitbucket?
– Autodidact
Dec 3 '13 at 5:51
2
2
@keen Zhemao/bitbucket-cli does provide the
pull_request
command since 6c50435 but it is not documented in the readme.– pylipp
Sep 20 '18 at 10:02
@keen Zhemao/bitbucket-cli does provide the
pull_request
command since 6c50435 but it is not documented in the readme.– pylipp
Sep 20 '18 at 10:02
|
show 6 more comments
I wasn't too satisfied with the answers in this thread, so I created an package for it:
https://www.npmjs.com/package/bitbucket-pr
Instructions:
npm i -g bitbucket-pr
... Go to folder where you want to create a pull request ...
bitbucket-pr
Cool! How is it different from the others? What was not satisfying you?
– Nicolas Raoul
Feb 16 '18 at 13:16
The answer from karojosh doesn't have a proper solution, and the answer from s3m3n requires too much overhead. My package just opens the browser of the pull request with pre-filled information, which is probably the fastest way of doing it.
– Karamell
Feb 16 '18 at 13:20
Great tool! this saves me a few clicks! It will be possible to give as argument the destination branch?
– Ryan Amaral
Apr 28 '18 at 19:14
Nice that you find it useful. It will always go to the main branch of the repo, which you can change in the bitbucket settings. If you really want to have the target branch as an argument, you could do a pull request. The thing is like 5 lines of bash so should be easy to hack :)
– Karamell
May 10 '18 at 11:08
3
It would be great if you provide the source of your npm modules, that way, anyone can validate it's source code before using it, or even improving it
– Luis Lobo Borobia
Jun 15 '18 at 15:16
|
show 2 more comments
I wasn't too satisfied with the answers in this thread, so I created an package for it:
https://www.npmjs.com/package/bitbucket-pr
Instructions:
npm i -g bitbucket-pr
... Go to folder where you want to create a pull request ...
bitbucket-pr
Cool! How is it different from the others? What was not satisfying you?
– Nicolas Raoul
Feb 16 '18 at 13:16
The answer from karojosh doesn't have a proper solution, and the answer from s3m3n requires too much overhead. My package just opens the browser of the pull request with pre-filled information, which is probably the fastest way of doing it.
– Karamell
Feb 16 '18 at 13:20
Great tool! this saves me a few clicks! It will be possible to give as argument the destination branch?
– Ryan Amaral
Apr 28 '18 at 19:14
Nice that you find it useful. It will always go to the main branch of the repo, which you can change in the bitbucket settings. If you really want to have the target branch as an argument, you could do a pull request. The thing is like 5 lines of bash so should be easy to hack :)
– Karamell
May 10 '18 at 11:08
3
It would be great if you provide the source of your npm modules, that way, anyone can validate it's source code before using it, or even improving it
– Luis Lobo Borobia
Jun 15 '18 at 15:16
|
show 2 more comments
I wasn't too satisfied with the answers in this thread, so I created an package for it:
https://www.npmjs.com/package/bitbucket-pr
Instructions:
npm i -g bitbucket-pr
... Go to folder where you want to create a pull request ...
bitbucket-pr
I wasn't too satisfied with the answers in this thread, so I created an package for it:
https://www.npmjs.com/package/bitbucket-pr
Instructions:
npm i -g bitbucket-pr
... Go to folder where you want to create a pull request ...
bitbucket-pr
answered Feb 16 '18 at 13:15
KaramellKaramell
464211
464211
Cool! How is it different from the others? What was not satisfying you?
– Nicolas Raoul
Feb 16 '18 at 13:16
The answer from karojosh doesn't have a proper solution, and the answer from s3m3n requires too much overhead. My package just opens the browser of the pull request with pre-filled information, which is probably the fastest way of doing it.
– Karamell
Feb 16 '18 at 13:20
Great tool! this saves me a few clicks! It will be possible to give as argument the destination branch?
– Ryan Amaral
Apr 28 '18 at 19:14
Nice that you find it useful. It will always go to the main branch of the repo, which you can change in the bitbucket settings. If you really want to have the target branch as an argument, you could do a pull request. The thing is like 5 lines of bash so should be easy to hack :)
– Karamell
May 10 '18 at 11:08
3
It would be great if you provide the source of your npm modules, that way, anyone can validate it's source code before using it, or even improving it
– Luis Lobo Borobia
Jun 15 '18 at 15:16
|
show 2 more comments
Cool! How is it different from the others? What was not satisfying you?
– Nicolas Raoul
Feb 16 '18 at 13:16
The answer from karojosh doesn't have a proper solution, and the answer from s3m3n requires too much overhead. My package just opens the browser of the pull request with pre-filled information, which is probably the fastest way of doing it.
– Karamell
Feb 16 '18 at 13:20
Great tool! this saves me a few clicks! It will be possible to give as argument the destination branch?
– Ryan Amaral
Apr 28 '18 at 19:14
Nice that you find it useful. It will always go to the main branch of the repo, which you can change in the bitbucket settings. If you really want to have the target branch as an argument, you could do a pull request. The thing is like 5 lines of bash so should be easy to hack :)
– Karamell
May 10 '18 at 11:08
3
It would be great if you provide the source of your npm modules, that way, anyone can validate it's source code before using it, or even improving it
– Luis Lobo Borobia
Jun 15 '18 at 15:16
Cool! How is it different from the others? What was not satisfying you?
– Nicolas Raoul
Feb 16 '18 at 13:16
Cool! How is it different from the others? What was not satisfying you?
– Nicolas Raoul
Feb 16 '18 at 13:16
The answer from karojosh doesn't have a proper solution, and the answer from s3m3n requires too much overhead. My package just opens the browser of the pull request with pre-filled information, which is probably the fastest way of doing it.
– Karamell
Feb 16 '18 at 13:20
The answer from karojosh doesn't have a proper solution, and the answer from s3m3n requires too much overhead. My package just opens the browser of the pull request with pre-filled information, which is probably the fastest way of doing it.
– Karamell
Feb 16 '18 at 13:20
Great tool! this saves me a few clicks! It will be possible to give as argument the destination branch?
– Ryan Amaral
Apr 28 '18 at 19:14
Great tool! this saves me a few clicks! It will be possible to give as argument the destination branch?
– Ryan Amaral
Apr 28 '18 at 19:14
Nice that you find it useful. It will always go to the main branch of the repo, which you can change in the bitbucket settings. If you really want to have the target branch as an argument, you could do a pull request. The thing is like 5 lines of bash so should be easy to hack :)
– Karamell
May 10 '18 at 11:08
Nice that you find it useful. It will always go to the main branch of the repo, which you can change in the bitbucket settings. If you really want to have the target branch as an argument, you could do a pull request. The thing is like 5 lines of bash so should be easy to hack :)
– Karamell
May 10 '18 at 11:08
3
3
It would be great if you provide the source of your npm modules, that way, anyone can validate it's source code before using it, or even improving it
– Luis Lobo Borobia
Jun 15 '18 at 15:16
It would be great if you provide the source of your npm modules, that way, anyone can validate it's source code before using it, or even improving it
– Luis Lobo Borobia
Jun 15 '18 at 15:16
|
show 2 more comments
Tried and tested :
Generate personal access token by clicking here
Save the Unique token id, append it after "Bearer in header".
For example: "Authorization : Bearer MDg4MzA4NTcfhtrhthyt/Thyythyh "
Complete JSON sample here:
Step 1 to enter the details and necessary headers
Try running it
Step 2Output on BitBucket, You will be able to see the pull request
Final output
Command Line Syntax:
curl -i -X POST -H "Authorization:Bearer MDg4MzA4NTk/TlMSS6Ea" -H "X-Atlassian-Token:no-check" -H "Content-Type:application/json" -d '{"description":"1. Changes made 2. Changes made 3. Hello hanges","closed":false,"fromRef":{"id":"refs/heads/branch","repository":{"name":"From Repository ","project":{"key":"ProjectName"},"slug":"From Repository "}},"state":"OPEN","title":"Merge changes from branch to master","locked":false,"reviewers":,"open":true,"toRef":{"id":"refs/heads/master","repository":{"name":"RepoName","project":{"key":"ProjectName"},"slug":"RepoName"}}}' 'https://bitbucket.agile.com/rest/api/1.0/projects/projectName/repos/repoName/pull-requests'
add a comment |
Tried and tested :
Generate personal access token by clicking here
Save the Unique token id, append it after "Bearer in header".
For example: "Authorization : Bearer MDg4MzA4NTcfhtrhthyt/Thyythyh "
Complete JSON sample here:
Step 1 to enter the details and necessary headers
Try running it
Step 2Output on BitBucket, You will be able to see the pull request
Final output
Command Line Syntax:
curl -i -X POST -H "Authorization:Bearer MDg4MzA4NTk/TlMSS6Ea" -H "X-Atlassian-Token:no-check" -H "Content-Type:application/json" -d '{"description":"1. Changes made 2. Changes made 3. Hello hanges","closed":false,"fromRef":{"id":"refs/heads/branch","repository":{"name":"From Repository ","project":{"key":"ProjectName"},"slug":"From Repository "}},"state":"OPEN","title":"Merge changes from branch to master","locked":false,"reviewers":,"open":true,"toRef":{"id":"refs/heads/master","repository":{"name":"RepoName","project":{"key":"ProjectName"},"slug":"RepoName"}}}' 'https://bitbucket.agile.com/rest/api/1.0/projects/projectName/repos/repoName/pull-requests'
add a comment |
Tried and tested :
Generate personal access token by clicking here
Save the Unique token id, append it after "Bearer in header".
For example: "Authorization : Bearer MDg4MzA4NTcfhtrhthyt/Thyythyh "
Complete JSON sample here:
Step 1 to enter the details and necessary headers
Try running it
Step 2Output on BitBucket, You will be able to see the pull request
Final output
Command Line Syntax:
curl -i -X POST -H "Authorization:Bearer MDg4MzA4NTk/TlMSS6Ea" -H "X-Atlassian-Token:no-check" -H "Content-Type:application/json" -d '{"description":"1. Changes made 2. Changes made 3. Hello hanges","closed":false,"fromRef":{"id":"refs/heads/branch","repository":{"name":"From Repository ","project":{"key":"ProjectName"},"slug":"From Repository "}},"state":"OPEN","title":"Merge changes from branch to master","locked":false,"reviewers":,"open":true,"toRef":{"id":"refs/heads/master","repository":{"name":"RepoName","project":{"key":"ProjectName"},"slug":"RepoName"}}}' 'https://bitbucket.agile.com/rest/api/1.0/projects/projectName/repos/repoName/pull-requests'
Tried and tested :
Generate personal access token by clicking here
Save the Unique token id, append it after "Bearer in header".
For example: "Authorization : Bearer MDg4MzA4NTcfhtrhthyt/Thyythyh "
Complete JSON sample here:
Step 1 to enter the details and necessary headers
Try running it
Step 2Output on BitBucket, You will be able to see the pull request
Final output
Command Line Syntax:
curl -i -X POST -H "Authorization:Bearer MDg4MzA4NTk/TlMSS6Ea" -H "X-Atlassian-Token:no-check" -H "Content-Type:application/json" -d '{"description":"1. Changes made 2. Changes made 3. Hello hanges","closed":false,"fromRef":{"id":"refs/heads/branch","repository":{"name":"From Repository ","project":{"key":"ProjectName"},"slug":"From Repository "}},"state":"OPEN","title":"Merge changes from branch to master","locked":false,"reviewers":,"open":true,"toRef":{"id":"refs/heads/master","repository":{"name":"RepoName","project":{"key":"ProjectName"},"slug":"RepoName"}}}' 'https://bitbucket.agile.com/rest/api/1.0/projects/projectName/repos/repoName/pull-requests'
edited Dec 3 '18 at 16:56
answered Nov 30 '18 at 20:17
jasminder pal singh sehgaljasminder pal singh sehgal
11
11
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f8721730%2fbitbucket-send-a-pull-request-via-command-line%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown