您的位置:首页 > 其它

git 常用操作

2016-01-10 21:03 267 查看
命令行

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://zhoushengchao@bitbucket.org/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://zhoushengchao@bitbucket.org/zhoushengchao/h5canvas.git
从远程获取最新版本到本地

git fetch origin master:tmp

git diff tmp

git merge tmp

从远程获取最新的版本到本地的tmp分支上 之后再进行比较合并

如果不想要temp分支了,可以删除此分支

git branch -d tmp
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: