git常用命令

git global setup

git config --global user.name "yourname"
git config --global user.email "your@email.com"

Create a new repository

git clone git@yourrepoaddress.git
cd theFileFoldYouCloned
touch README.md
git add README.md
git commit -m"add README"
git push -u origin master

Push an existing folder. ==> you need to have a blank project in remote 

cd existing folder
git init
git remote add origin git@yourrepoaddress.git
git add .
git commit -m"Initial commit"
git push -u origin master

Push an existing Git repository

cd existing_repo
git remote rename origin old-origin
git remote add origin git@yourrepoaddress.git
git push -u origin --all
git push -u origin --tags

Cancel the relate between local repo and remote repo

git remote remove origin

 

Other commands we commonly used

git fetch
git pull origin
git push origin
git push --set-upstream origin 'branch'
git merge --abort

  

posted @ 2023-10-11 10:56  Shalome🍊  阅读(3)  评论(0编辑  收藏  举报