GIT engineering Migration (Modify submit server address) method

Source: Internet
Author: User

git remote set-url [--push] <name> <newurl> [<oldurl>]
git remote Set-url--add [--push] <name> <newurl>
git remote Set-url--delete [--push] <name> <url>
For example: Git remote set-URL origin git@GitHub. COM:user/repo. git

Git is recently ready to move to a location where the command line is used to do the following.

1.git init initializes the Git repository, and this time found a more. Git folder in the local folder.

2.git remote Add-url origin add repository address

3. Git remote Set-url origin associated repository address

The main point here is to hook up the local library with the remote repository.

Use a graph to represent:

4. Next, there are two scenarios, that is, whether Git location 2 is an empty address.

A) If it is an empty address, OK is simple.

First git Add.

Then git commit-m '

With this command: git push, if not so you can use the strong push git push-f

Of course, this is pushing the current project to the Remote Default branch (master)

Extension: If you want to push all the branches that are local including master, you can use the following methods:

(1) Git push--all-f (theory possible)

(2) Insurance Use the following command: (must be possible)

Git Checkout branch Name

Git push origin test (local branch): Test (remote branch)

If it is not good, be sure to overwrite the words, you can add a-f

Git push-f origin test (local branch): Test (remote branch)

b) If it is not an empty address, OK is also very simple, first clear the address, and then push.

This is how I use the empty method here.

First, create a folder locally, and then use:

git clone address

Hook the local to the remote library, and then use the Purge command.

Git rm.

or git rm-r file name (delete folder)

Then push it so that the remote repository is emptied. And then execute a)

GIT engineering Migration (Modify submit server address) method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.