I only want to rebase one folder.
Is it possible to do something like
git pull --rebase origin/master path/to/folder/or/file.txt
and only that path will be updated?
The quick answer is "no".
The longer answer depends on what you are trying to accomplish, and whether or not you have any changes to any of the files/folders you want to rebase, and what if any history you are interested in showing.
If you have no changes on your branch, and you just want to grab the latest file from origin/master and put it in your working directory, and you don't want there to be any 'history' of what happened, then you could do
git fetch origin master
git checkout origin/master -- path/to/file.txt
For anything more complicated than that it gets ugly fast.
My idea for this is something along the lines:
git cherry-pick $(git log --oneline HEAD..origin/master -- path/to/something | cut -d' ' -f1 | tac| xargs echo)
[Edit] As suggested by @CervEd there is a more straightforward way
git cherry-pick $(git rev-list HEAD..origin/master -- path)
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