I have two files called vvn.c
and aqu.c
I did changes to vvn.c
and I have that commit in my git.
How to cherry-pick the same changes to aqu.c
The only difference is the API's.
vvn.c
contains API's as vvn_function_names()
whereas aqu.c
contains API's as unions_function_names()
I don't know how to do that. I know about cherry-picking into the same file. Is there any way to do that?
It is possible to cherry pick from another repo using the command line. You will first need to add the other repository as a remote and then fetch the changes. From there, you should be able to see the commit in your repo and cherry pick it.
Not exactly cherry-pick, but you might want to use:
git checkout <branch or sha of commit> -- filename
This checkouts the file by its version in another branch; it is the easiest possible solution, if it satisfy your needs (i.e., if you don't need to actually merge changes to the file from two separate branches)
The other possibility is to generate diff (you can generate diff from a range of commits just and limit it to one file) and then apply the diff. Check out: How to diff the same file between two different commits on the same branch?
Basically you need to make a diff on the vvn.c
changes and apply them to a aqu.c
. See e.g. here: How to apply a Git patch to a file with a different name and path?
However, this is quite tricky thing. Why do you have different file names which anyhow similar so that you should make same changes?
Probably it is better to come up with some another approach. E.g. for a C you could use #include and extract common part into a separate file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With