到http://github.com/ 点击New project
输入Project name,Description。点击Create project
然后页面会有一些提示:
# Git global setup:
git config --global user.name "曹洪瑾"
git config --global user.email "huntinux@gmail.com"
# Create Repository
mkdir newproject
cd newproject
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin https://github.com/huntinux/gitpractise.git
git push -u origin master
# Existing Git Repo?
cd existing_git_repo
git remote add origin git地址
git push -u origin master
根据以上提示,可以新建一个project, 它只包含一个README文件。
touch newfile
git add newfile
git commit -m 'add a newfile'
git push origin master
git rm newfile
git commit -m 'del the newfile'
git push origin mastergit checkout -b branch1 # create branch1 and jump to it
vim README # modify something
git commit -a -m 'add some text to README.md [branch1]' # commit
git push origin branch1 # pushgit checkout master # to master branch1
git merge branch1 # merge branch1 to master
git branch -d branch1 # delete branch1
git push origin master # push git branch -d branch-name git push origin :branch-name # 冒号前面的空格不能少,原理是把一个空分支push到server上,相当于删除该分支。mkdir newdir
touch newdir/newfile
git add newdir
git commit -m 'add new dir'
git push origin mastergit rm -r newdir
git commit -m 'del new dir'
git push origin master将python-sample中的tools加入了project,方便使用virtualenv。
git clone -b <branch> <remote_repo>
example: clone nginx-0.1 branch
git clone -b nginx-0.1 https://github.com/nginx/nginx.git