Wednesday, 24 September 2014

move a git project to a new git project

https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line

first you should create the new git project and the link of it is:
https://github.com/xx/ff.git
  
Last login: Wed Sep 24 08:39:38 on ttys002
aa-iMac-3:yammerpeter Peter$ pwd
/Users/Peter/Documents/code/yammerpeter
aa-iMac-3:yammerpeter Peter$ ls
README.md src  war
aa-iMac-3:yammerpeter Peter$ git init
Reinitialized existing Git repository in /Users/Peter/Documents/code/yammerpeter/.git/
aa-iMac-3:yammerpeter Peter$ git add .
aa-iMac-3:yammerpeter Peter$ git commit . -m "merge to ms repo"
[master 1f18757] merge to ms repo
 Committer: wangpingsx 
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
 
    git config --global user.name "Your Name"
    git config --global user.email you@example.com
 
After doing this, you may fix the identity used for this commit with:
 
    git commit --amend --reset-author
 
 2 files changed, 93 insertions(+), 24 deletions(-)
aa-iMac-3:yammerpeter Peter$ git remote add origin https://github.com/xx/ff.git
fatal: remote origin already exists.
aa-iMac-3:yammerpeter Peter$ git remote -v
origin https://github.com/wangpingsx/yammerpeter.git (fetch)
origin https://github.com/wangpingsx/yammerpeter.git (push)
aa-iMac-3:yammerpeter Peter$ git remote set-url origin https://github.com/xx/ff.git
aa-iMac-3:yammerpeter Peter$ git remote -v
origin https://github.com/xx/ff.git (fetch)
origin https://github.com/xx/ff.git (push)
aa-iMac-3:yammerpeter Peter$ git push origin master
Counting objects: 136, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (131/131), done.
Writing objects: 100% (136/136), 27.15 MiB | 1.03 MiB/s, done.
Total 136 (delta 53), reused 0 (delta 0)
To https://github.com/xx/ff.git
 * [new branch]      master -> master
aa-iMac-3:yammerpeter Peter$ 
  [Restored]
Last login: Wed Sep 24 17:33:04 on console
aa-iMac-3:yammerpeter Peter$

No comments:

Post a comment