git 常用操作

命令行
1. 从零开始
    bitbucket.org网站登录后创建版本库
设置您的本地目录
Set up Git on your machine if you haven't already.
mkdir /path/to/your/project
cd /path/to/your/project
git init
git config --global user.name 'zhoushengchao'
git remote add origin https://[email protected]/zhoushengchao/h5canvas.git
创建你的第一个文件,提交,然后推送到仓库。
echo "shengchao zhou" >> contributors.txt
git add contributors.txt
git commit -m 'Initial commit with contributors'
git push -u origin master
干的漂亮,现在你已经完成所有安装步骤!开始编码吧或者创建一个团队并且邀请新人加入吧。


2. 有一个已经存在的项目
    bitbucket.org已经有个一个版本仓库
本地创建一个新目录,拉取仓库上的最新版本到本地
cd /path/to/my/repo
git init
git config --global user.name 'zhoushengchao'
git remote add origin https://[email protected]/zhoushengchao/h5canvas.git
从远程获取最新版本到本地
    git fetch origin master:tmp
    git diff tmp 
    git merge tmp
    从远程获取最新的版本到本地的tmp分支上 之后再进行比较合并
    如果不想要temp分支了,可以删除此分支
    git branch -d tmp


  

你可能感兴趣的:(git 常用操作)