Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
136 views
in Technique[技术] by (71.8m points)

gitorious - Is it possible to create merge requests in pure Git from the command line?

I'm using a behind-firewall install of Gitorious.

I can go into the web application and create a pull request from a clone and target the master repo from which it was cloned.

I'd like to be able to do this on the command line. More specifically, I'd like to be able to open merge requests from the command line from one branch to another (rather than from clone to seed repo).

Since I'm not using Github, I can't use Github specific tools or libraries. Is this possible?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The answer given by svick is not correct. It is possible.

There's git request-pull which is part of the Git suite. Using that command line tool, you could create a pull request that could be sent per E-Mail.

Example:
your origin holds a branch master. Now you create a local bugfix branch fix, implement the bug fix and push that fix branch to origin:

git push origin fix:fix

Then, you want someone to merge the changes made in the fix branch into master. Create the pull request with

git request-pull master origin

This will create a text formatted as follows:

The following changes since commit <SHA of master>:

  <commit message of SHA of mster>

are available in the git repository at:
  <repo location> fix

<User Name> (<Number of Commits>):
      <messages of the commits>
      ...

 <changed files>
 ...
 <file statistics>

If the merge request shall go to somebody that cannot access your repo where you pushed your changes, there's always the opportunity of doing it with git format-patch.

After pushing your fix branch to origin (you don't even need to do that), while being on the fix branch create the patch using

git format-patch master..

This will create a patch file for each commit you did in fix since branching off master. You could bundle the generated .patch files with

tar czf fix.tgz *.patch

and then send to someone e.g. via E-Mail to review and apply.

For the sake of completeness: applying the patches could be done with git am.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...