mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-08-10 15:47:54 +02:00
Copy a file including history from one repo to an other
@ -51,3 +51,17 @@ or if you want to go back to latest previous commit:
|
|||||||
git reset --hard HEAD^
|
git reset --hard HEAD^
|
||||||
```
|
```
|
||||||
> **IMPORTANT:** *reset with `--hard` parameter reset your commits and you may no longer have access to your changes.*
|
> **IMPORTANT:** *reset with `--hard` parameter reset your commits and you may no longer have access to your changes.*
|
||||||
|
|
||||||
|
### Copy a file including history from one repo to an other
|
||||||
|
```
|
||||||
|
git log --pretty=email --patch-with-stat --reverse --full-index --binary -- path/to/file_or_folder > /tmp/commits.log
|
||||||
|
```
|
||||||
|
Fix the relative path to new repo
|
||||||
|
```
|
||||||
|
sed -i 's|path/to/file|new/path/to/file|g' /tmp/commits.log
|
||||||
|
```
|
||||||
|
Reapply it to new repo
|
||||||
|
```
|
||||||
|
cd /path/to/new/repo
|
||||||
|
git am < /tmp/commits.log
|
||||||
|
```
|
Reference in New Issue
Block a user