Git與Github入門資料
Git主要優(yōu)勢及安裝
git,一個(gè)非常強(qiáng)大的版本管理工具。Github則是一個(gè)基于Git的日益流行的開源項(xiàng)目托管庫。Git與svn的最大區(qū)別是,它的使用流程不需要聯(lián)機(jī),可以先將對代碼的修改,評論,保存在本機(jī)。等上網(wǎng)之后,再實(shí)時(shí)推送過去。同時(shí)它創(chuàng)建分支與合并分支更容易,推送速度也更快,配合Github提交需求也更容易。
git的入門,稍微有點(diǎn)麻煩,需要在本機(jī)創(chuàng)建一個(gè)ssh的鑰匙,其他的則??仗炜樟?。windows下可以參考這篇教程,Mac等更多教程則可以參考Github官方。
Git全局設(shè)置
下載并安裝Git
git config --global user.name "Your Name"
git config --global user.email youremail@email.com
將Git項(xiàng)目與Github建立聯(lián)系
mkdir yourgithubproject
cd yourgithubproject
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin git@github.com:yourgithubname/yourgithubproject.git
git push origin master
導(dǎo)入現(xiàn)有的Git倉庫
cd existing_git_repo
git remote add origin git@github.com:yourgithubname/yourgithubproject.git
git push origin master
導(dǎo)入現(xiàn)有的Subversion倉庫
點(diǎn)擊此處
git最主要的命令
git --help
The most commonly used git commands are:
add Add file contents to the index
bisect Find by binary search the change that introduced a bug
branch List, create, or delete branches
checkout Checkout a branch or paths to the working tree
clone Clone a repository into a new directory
commit Record changes to the repository
diff Show changes between commits, commit and working tree, etc
fetch Download objects and refs from another repository
grep Print lines matching a pattern
init Create an empty git repository or reinitialize an existing one
log Show commit logs
merge Join two or more development histories together
mv Move or rename a file, a directory, or a symlink
pull Fetch from and merge with another repository or a local branch
push Update remote refs along with associated objects
rebase Forward-port local commits to the updated upstream head
reset Reset current HEAD to the specified state
rm Remove files from the working tree and from the index
show Show various types of objects
status Show the working tree status
tag Create, list, delete or verify a tag object signed with GPG
第一次提交的時(shí)候
git push yourgithubproject maste
日常提交常用命令
git add .
git commit -a -m"some files"
git push yourgithubproject
Textmate的Git Bundles

更多參考
|