top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Applying patch to Drupal module, using GIT

0 votes

I'm new to using Git and I'm a little confused. I'm trying to patch a module and I've gone to terminal and gone to the folder I need to patch via FTP.

I've been following this tutorial

but whenever I add the apply git command I get 'invalid command'. Does Git only apply patches locally? What am I dong wrong?

posted Jun 24, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

1) Do I understand correctly, that you're using some FTP client and "gone to the folder" in this context means you used that FTP client to navigate to the remote directory containing the file to patch?

2) Please try to explain this in plain English: it's not really appropriate to ask people to spend their time watching random videos to help you solve your problem.

3) What's the precise command you're trying to run and what's the precise error message it generates? Please do plain copying and pasting.

Your question contains too little information to try to answer.

Running git foo tells me
git: 'foo' is not a git command. See 'git --help'.

Neither bash nor zsh do not use the wording "invalid command", and nether does Windows shell (cmd.exe) so I'm not sure what happens as you told us precisely zero information about your setup (note that the fact you're dealing with Drupal is most probably irrelevant to the problem in hand, and information about your system *is* relevant).

answer Jun 24, 2013 by anonymous
My bad sorry for posting a 10mins+ video. Anywho yes I'm trying to update a module folder remotely. Basically I was following a vid tutorial which eventually executed 'git apply example.patch' but I just get 'invalid command'. Is this because you can only patch Drupal modules locally?
Similar Questions
0 votes

After switching from svn/hg to git and getting some experience, I feel I'm ready to figure out which questions aren't too obvious. My feeling is the current question isn't.

Today I was hacking away, only to discover that I was really working on too much stuff at once. I wanted to stash away a sub-set of my changes, and leave the rest to focus on first. So I did a 'git stash --patch', selected the patches I wanted to move away for now. Only to discover that I stashed away 2 patches too many .... Bummer.

Alas: I kind of hoped I could do something like 'git stash apply --patch stash@{1}'...... but that didn't quite work: I just got the full stash applied on top of the working directory (to be verbose: this was done after stashing the remaining patches).
I hope my situation was explained clearly enough. My question is not about how to recover. That's easy by redoing the original stash command, but properly this time. My question is more about learning something more about git, in case I end up in the same, or a similar situation in the future:
* is there a way to force 'git stash --patch' to create a separate stash for each patch that I select? This would make it possible to apply each patch again afterwards, and would have been a perfect solution in my case as well
* otherwise, is there a way to achieve the result I had hoped for when running 'git stash apply --patch', namely to selectively apply hunks

In case the answer to both of these is 'No', what would be the proper way and/or place to suggest such a feature?

0 votes

I don't quite manage to figure out gits argv parsing and would need some help on the way.

I want:
git format-patch -o outdir HEAD~

Work exactly the way it does now, setting output_directory to outdir. But I also want
git format-patch -o HEAD~

to set output_directory with a NULL value so that I can assign a default value to it. Is that even possible with the current argv-parsing implementation?

The currect argv parser is using OPTION_CALLBACK so I thought that that callback should be able to determine if there was an outdir supplied or not.

Or is the correct solution to also add a bolean type OPTION_BOOLEAN for -o?

+1 vote

I just finished building and installing git on my Android device. After testing, I'd like to build it in such a way that I can tarball and upload/send it.

Are there any make targets that would allow me to do that or do I need to rebuild with the NO_CROSS_DIRECTORY_HARDLINKS option and install to a stage /usr/git or /usr/local/git?