Salamandar
Salamandar

Reputation: 598

Get an old commit in a subfolder

Well, it's pretty hard to explain but it's about GTK3 themes versions. Before, we had

theme_name/
    gtk-2.0/
    gtk-3.0/

But GTK3.20 broke some themes so we should have done :

cp -R gtk-3.0/ gtk-3.20
#theme_name/
#    gtk-2.0/
#    gtk-3.0/
#    gtk-3.20/
# Modify the gtk-3.20 directory to match the new gtk release
git commit "copy and adapt to new version"

We didn't do the new folder. So now we have the git tree :

* mv gtk-3.0 gtk-3.20, but we don't have the gtk-3.0 directory :(   
|
* 3.20 stable in the gtk-3.0 directory
|
* 3.18 stable in the gtk-3.0 directory (3.20 didn't exist)

How can I "merge" the old commit to get back the 3.18 release (but only the gtk3.20 directory) ?

I could do a copy-paste but it's not in the git spirit ;)

Upvotes: 1

Views: 166

Answers (1)

Vampire
Vampire

Reputation: 38724

git checkout <branch where the move happened and that should be fixed>
git reset --hard <commit-ish of good version>
git merge --no-ff HEAD@{1}
git checkout HEAD@{1} -- theme_name/gtk-3.0
git commit --amend -m "bring back gtk-3.0"

Upvotes: 3

Related Questions