Created
October 8, 2012 17:31
-
-
Save SaitoWu/3853774 to your computer and use it in GitHub Desktop.
grit patch apply
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require'grit' | |
repo = Grit::Repo.new(".") #=> #<Grit::Repo "/Users/saito/hanwen/.git"> | |
# check_applies => 0(can apply) or 1(can not) | |
repo.git.check_applies("master", "new") #=> 0 | |
patch = repo.git.get_patch("new") #=> raw_patch | |
# apply_patch => tree_sha | |
repo.git.apply_patch("master", patch) #=> "c9a4861d9b3229974a0b1b05b87583ab3a887629" | |
# commit => commit_sha | |
# commit_message, array_of_commit, actor, tree_sha, head | |
repo.index.commit('message', [repo.commits.first], nil, nil, 'master') #=> "877166a550805fe2ad670399a5fb84a71b643998" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require'grit' | |
repo = Grit::Repo.new(".") #=> #<Grit::Repo "/Users/saito/hanwen/.git"> | |
# check_applies => 0(can apply) or 1(can not) | |
repo.git.check_applies("master", "new") #=> 0 | |
repo.git.native(:merge, {:no_ff => true}, "master", "new") #=> "Merge made by the 'recursive' strategy.\n readme.md | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@vsizov Grit native merge must run in a work tree. .. still need a satellite repo.