您的位置:首页 > 其它

Git入门(一)简易的命令行入门教程:

2016-04-13 22:05 651 查看
简易的命令行入门教程:

Git 全局设置:

git config --global user.name "NicholasYao"
git config --global user.email "414255115@qq.com"




创建 GIT 仓库:
mkdir TikuApp
cd TikuApp
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin https://git.oschina.net/youraccount/yourproject.git git push -u origin master


克隆到本地:

<pre class="dark" style="box-sizing: inherit; overflow: auto; font-family: Menlo, "Liberation Mono", Consolas, "DejaVu Sans Mono", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; color: rgb(245, 245, 245); padding: 10px; font-size: 15px; line-height: 19.95px; background: rgb(51, 51, 51);">git clone</pre>
</p>



添加所有文件到暂存区:

<pre class="dark" style="box-sizing: inherit; overflow: auto; font-family: Menlo, "Liberation Mono", Consolas, "DejaVu Sans Mono", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; color: rgb(245, 245, 245); padding: 10px; line-height: 19.95px; background: rgb(51, 51, 51);">git add .</pre>
</p>



删除版本库的文件:

<pre class="dark" style="box-sizing: inherit; overflow: auto; font-family: Menlo, "Liberation Mono", Consolas, "DejaVu Sans Mono", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; color: rgb(245, 245, 245); padding: 10px; line-height: 19.95px; background: rgb(51, 51, 51);">git rm <file></pre>
</p>


拉取到本地:

<pre class="dark" style="box-sizing: inherit; overflow: auto; font-family: Menlo, "Liberation Mono", Consolas, "DejaVu Sans Mono", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; color: rgb(245, 245, 245); padding: 10px; line-height: 19.95px; background: rgb(51, 51, 51);">git pull</pre>
</p>


将本地主分支推到远程主分支:

<pre class="dark" style="box-sizing: inherit; overflow: auto; font-family: Menlo, "Liberation Mono", Consolas, "DejaVu Sans Mono", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; color: rgb(245, 245, 245); padding: 10px; line-height: 19.95px; background: rgb(51, 51, 51);">git push origin master</pre>
</p>


将远程主分支合并到当前主分支:

<pre class="dark" style="box-sizing: inherit; overflow: auto; font-family: Menlo, "Liberation Mono", Consolas, "DejaVu Sans Mono", "Ubuntu Mono", "Courier New", "andale mono", "lucida console", monospace; color: rgb(245, 245, 245); padding: 10px; line-height: 19.95px; background: rgb(51, 51, 51);">git merge origin/master</pre>
</p>









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