初始化init:
git init
git status
git add .
git commit -am "init projrct"
添加远程仓库:
git remote add origin [email protected]:liuge36/mmall.git
推送:
git push -u -f oragin master
查看远程分支:
git branch -r
采用分支开发 主干发布:
git checkout -b V-1.0 origin/master
当前分支:
git branch
把当前的分支推送给远程的分支:
git push origin HEAD -u
=================================================
查看使用的传输协议:
git remote -v
重新设置成ssh的方式:(gitalb 码云 github应该都是类似的操作)
git remote rm origin
git remote add origin [email protected]:liuge36/MyFirstTest.git
git push -u origin master
重新设置成http的方式:
git remote rm origin
git remote add origin http://gitlab.qiziqi.xyz/liuge36/MyFirstTest.git
git push -u origin master
这里接下来就是输入自己的gitlab的用户名和登录密码
================================================
Command line instructions
Git global setup
git config --global user.name "liuge36"
git config --global user.email "[email protected]"
Create a new repository
git clone [email protected]:liuge36/MyFirstTest.git
cd MyFirstTest
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
Existing folder
cd existing_folder
git init
git remote add origin [email protected]:liuge36/MyFirstTest.git
git add .
git commit -m "Initial commit"
git push -u -f origin master
Existing Git repository
cd existing_repo
git remote rename origin old-origin
git remote add origin [email protected]:liuge36/MyFirstTest.git
git push -u origin --all
git push -u origin --tags
================gitignore========================
*.class
#package file
*.war
*.ear
#maven
target/
#eclipse ignore
.settings/
.project
.classpatch
#idea
.idea/
/idea/
*.ipr
*.iml
*.iws
#temp file
*.log
*.cache
*.diff
*.patch
*.tmp
# system ignore
.DS_Strore
Thnmbs.db
原文地址:https://www.cnblogs.com/liuge36/p/9882822.html