git 基础用法

# 初始化空的版本库
git init

# 克隆项目到本地
git clone [email protected]:campus2015/training2.git

# 新建分支并切换到新的分支, 现在这个分支在本地, newBranch 是分支名, 请根据自己的需要命名自己的分支
git checkout -b newBranch

# 切换到自己的分支
git checkout oneBranch

# 添加本地未添加的文件 pom.xml
git add pom.xml

# 所有更改加入到缓存区
git add -A

# 提交一次,修改进入本地仓库
git commit -m 'first commit'

# commit的东西 push 到远程分支 newBranch
git push -u origin newBranch

# 远程更新合并到本地
git push -u origin haomiao.yang

# 删除远端分支 newBranch
git push origin :newBranch(origin和冒号中间要有空格)
git push origin --delete dev

# 查看git状态
git status

# 查看远程分支
git branch -avv

 

 

 

 

 

mkdir hoteldev1

cd hoteldev1

git init

touch README

git add README

git commit -m 'first commit'

git remote add origin [email protected]:san.zhang/hoteldev1.git

git push -u origin master

你可能感兴趣的:(git)