This is an old revision of the document!
Git作为VCS(Version Control System)的一种,与另一个比较有名的svn的最大区别在于Git是分布式,svn是集中式。具体来说,Git不分服务器端和客户端,只有远程仓库和本地仓库,两者完全平等,因此,Git可以离线查看日志和提交代码。
很多时候并不需要每个人都创建仓库,只需要一个人创建既可。因此我们从git clone到git push到git pull的整个过程介绍Git入门。
git clone <repository_url>
git add <file_path>
git commit -m <message>
git push
git pull
git status
git log
git stash
git stash pop
git checkout -- .
git checkout <branch_name>
:q
然后敲击回车即可退出(vim编辑器)*详见连接: http://git.mydoc.io/?t=180845
<note>
暂未找到打包为zip文件的方法
</note>
本方法用于提交包含目录结构的近期修改,例如打包包含目录结构的自上次发布以来的所有修改,以用于增量更新等。
git diff --name-only <branch_name_to_be_compared> <current_branch_name> | tar czf <tar_file_name_with_path.tar.gz> -T -
# 15分钟内不需要再次输入密码 git config credential.helper cache # 已经记住密码的情况下,想更改用户 git config --unset-all credential.helper git config --global --unset-all credential.helper sudo git config --system --unset-all credential.helper
Git flow是分支管理规范与工具,因此对原本的代码提交、拉取等没有任何影响,只是简化了分支切换、合并和删除操作。
Git flow默认master和develop两个分支为基础分支,创建feature和release分支时基于develop,创建hotfix分支时基于master,与当前所在分支无关。详见Git flow分支管理示意图