Git與Github資料 分類: 開發工具 2015-07-22 09:40 9人閱讀 評論(0) 收藏

Git主要優點及安裝

git,一個很是強大的版本管理工具。Github則是一個基於Git的日益流行的開源項目託管庫。Git與svn的最大區別是,它的使用流程不須要聯機,能夠先將對代碼的修改,評論,保存在本機。等上網以後,再實時推送過去。同時它建立分支與合併分支更容易,推送速度也更快,配合Github提交需求也更容易。html

git的入門,稍微有點麻煩,須要在本機建立一個ssh的鑰匙,其餘的則海空天空了。windows下能夠參考這篇教程,Mac等更多教程則能夠參考Github官方git

Git全局設置

下載並安裝Gitgithub

git config --global user.name "Your Name"
git config --global user.email youremail@email.com

將Git項目與Github創建聯繫

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

導入現有的Git倉庫

cd existing_git_repo
git remote add origin git@github.com:yourgithubname/yourgithubproject.git
git push origin master

導入現有的Subversion倉庫

點擊此處spring

git最主要的命令

git --help

The most commonly used git commands are:windows

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

第一次提交的時候

git push yourgithubproject maste

平常提交經常使用命令

git add .
git commit -a -m"some files"
git push yourgithubproject

Textmate的Git Bundlesssh


轉自  http://www.yangzhiping.com/tech/git.html
svn

相關文章
相關標籤/搜索