How to completely migrate the branch version and submit log records for the git project


When we are in the development process, the original remote warehouse address is A, but later we need to replace it with a new warehouse address B, but we want to keep the original branch, submission records, etc., then we need to use mirroring to Handle it for us. 

The operation steps are as follows:

1. Create a new project in places such as gitlab or github, and get the new address B

2. Enter the project that needs to be migrated, and perform a mirror backup first

```
 cd /Users/jalen/Desktop/dm/android/appV2
 
 mkdir mirror
 
 cd mirror
 
 git clone --mirror [email protected]:jalen/appV2.git
```

 

> The address of `[email protected]:jalen/appV2.git` is warehouse address A


3. Set a new remote warehouse address B

```
git remote set-url origin http://42.92.210.102:3000/jalen/appMain.git
```
> `http://42.92.210.102:3000/jalen/appMain.git`This address is the new warehouse Address B

4. Finally push the image

```
git push  --mirror
```

 


All in all.

Guess you like

Origin blog.csdn.net/admin_jalen/article/details/125636364