git-am

Does JGit API have all Git commands

一个人想着一个人 提交于 2019-12-23 02:32:40
问题 I am trying to port a shell script to Java which contains a few Git commands which I have mostly managed to find in the JGit API. I have not, however, managed to find the remote or am commands, is this because the don't exist or I am just looking in the wrong place for them. If they don't exist is there another way to use them? 回答1: There is no ready-to run counterpart for git remote and am in JGit, but it should be possible to implement (a subset of) them with reasonable effort. Those sub

How to apply a Git patch to a file with a different name and path?

情到浓时终转凉″ 提交于 2019-12-17 17:26:51
问题 I have two repositories. In one, I make changes to file ./hello.test . I commit the changes and create a patch from that commit with git format-patch -1 HEAD . Now, I have a second repository that contains a file that has the same contents as hello.test but is placed in a different directory under a different name: ./blue/red/hi.test . How do I go about applying the aforementioned patch to the hi.test file? I tried git am --directory='blue/red' < patch_file but that of course complains that

Does JGit API have all Git commands

こ雲淡風輕ζ 提交于 2019-12-06 15:08:06
I am trying to port a shell script to Java which contains a few Git commands which I have mostly managed to find in the JGit API. I have not, however, managed to find the remote or am commands, is this because the don't exist or I am just looking in the wrong place for them. If they don't exist is there another way to use them? There is no ready-to run counterpart for git remote and am in JGit, but it should be possible to implement (a subset of) them with reasonable effort. Those sub-commands of git remote that query or manipulate the config file can be emulated by directly accessing the

What is the difference between git cherry-pick and git format-patch | git am?

久未见 提交于 2019-11-30 06:01:16
问题 I sometimes need to cherry-pick a tag with a certain fix into my branch, and used to do so via git cherry-pick tags/myfix This works, but cherry-picking takes an increasingly long time doing "inexact rename detection". My hunch was that this could be faster with git format-patch -k -1 --stdout tags/myfix | git am -3 -k In fact, this turned out to apply the fix instantly, leaving my branch in exactly the same state as cherry-picking. Now my question is, what exactly does cherry-picking do

When applying a patch is there any way to resolve conflicts?

久未见 提交于 2019-11-29 18:45:34
I am on windows. For various reasons we have multiple git instances of different svn branches. Many times I want to fix an issue in repository A, generate a patch, and apply it to repository B. This works fine except if there are conflicts. When rebasing I just right click the folder and use tortioseGit and select the resolve option. This brings up a nice gui to let me work through my conflicts. Is there any way to accomplish this with rejected patch chunks? Here is my current approach to creating/applying the patches git format-patch master --stdout > c:\\patch\\file.patch git apply --reject

What is the difference between git cherry-pick and git format-patch | git am?

空扰寡人 提交于 2019-11-28 13:45:32
I sometimes need to cherry-pick a tag with a certain fix into my branch, and used to do so via git cherry-pick tags/myfix This works, but cherry-picking takes an increasingly long time doing "inexact rename detection". My hunch was that this could be faster with git format-patch -k -1 --stdout tags/myfix | git am -3 -k In fact, this turned out to apply the fix instantly, leaving my branch in exactly the same state as cherry-picking. Now my question is, what exactly does cherry-picking do differently? I thought cherry-picking was basically implemented as exactly this, but I must have been

When applying a patch is there any way to resolve conflicts?

谁说我不能喝 提交于 2019-11-28 13:34:14
问题 I am on windows. For various reasons we have multiple git instances of different svn branches. Many times I want to fix an issue in repository A, generate a patch, and apply it to repository B. This works fine except if there are conflicts. When rebasing I just right click the folder and use tortioseGit and select the resolve option. This brings up a nice gui to let me work through my conflicts. Is there any way to accomplish this with rejected patch chunks? Here is my current approach to

How to apply a Git patch to a file with a different name and path?

青春壹個敷衍的年華 提交于 2019-11-28 03:17:57
I have two repositories. In one, I make changes to file ./hello.test . I commit the changes and create a patch from that commit with git format-patch -1 HEAD . Now, I have a second repository that contains a file that has the same contents as hello.test but is placed in a different directory under a different name: ./blue/red/hi.test . How do I go about applying the aforementioned patch to the hi.test file? I tried git am --directory='blue/red' < patch_file but that of course complains that the files are not named the same (which I thought Git didn't care about?). I know I could probably edit