Linux下git的安装及简单使用
来源:互联网 发布:开淘宝客的条件 编辑:程序博客网 时间:2024/06/05 19:27
[root@localhost /]# yum install git [root@localhost /]# git config --global user.name "Your Name" [root@localhost /]# git config --global user.email "email@example.com" [root@localhost /]# mkdir uter [root@localhost /]# cd uter [root@localhost uter]# git init 初始化空的 Git 版本库于 /uter/.git/ [root@localhost uter]# ls -ah . .. .git //前面几步操作我们已经成功安装了git并创建了一个版本库,如果需要把这个版本库取消那么直接把(.git)这个文件删除就可以了 [root@localhost uter]# rm -rf .git //现在我们试试把文件上传到版本库 [root@localhost uter]# vim git.txt [root@localhost uter]# git add git.txt [root@localhost uter]# git status # 位于分支 master # # 初始提交 # # 要提交的变更: # (使用 "git rm --cached <file>..." 撤出暂存区) # # 新文件: git.txt # [root@localhost uter]# git commit -m "linux test git" [master(根提交) c87e19d] linux test git 1 file changed, 1 insertion(+) create mode 100644 git.txt [root@localhost uter]# git log //查看版本信息 //在这里我直接对接我github上的远程仓库[已经建好的] [root@localhost uter]# git remote add origin https://github.com/xuedongyue/learngit.git [root@localhost uter]# git merge origin/master [root@localhost uter]# git push -u origin master 接下来我们回到浏览器返回 Github 创建的仓库刷新一下,就可以看到文件已上传到Github上: 查看当前的远程库: [root@localhost uter]# git remote [root@localhost uter]# git remote -v // -v 参数,可以看到每个别名的实际链接地址。 提取远程仓库: 1、从远程仓库下载新分支与数据 [root@localhost uter]# git fetch //该命令执行完后需要执行git merge 远程分支到你所在的分支。 2、从远端仓库提取数据并尝试合并到当前分支 [root@localhost uter]# git pull //该命令就是在执行 git fetch 之后紧接着执行 git merge 远程分支到你所在的任意分支。 假设你配置好了一个远程仓库,并且你想要提取更新的数据,你可以首先执行 git fetch [alias] 告诉 Git 去获取它有你没有的数据,然后你可以执行 git merge [alias]/[branch] 以将服务器上的任何更新(假设有人这时候推送到服务器了)合并到你的当前分支。 [root@localhost uter]# git fetch origin [root@localhost uter]# git merge origin/master (远程库名/分支名) 推送到远程仓库: [root@localhost uter] git push origin master
0 0
- Linux下git的安装及简单使用
- Linux下git的安装及简单使用
- Linux下git的安装及简单使用
- linux下bochs的安装及简单使用
- Linux环境下Mysql的安装及简单使用
- Linux下安装及简单使用nmap
- Linux下安装及简单使用nmap
- ubuntu下git的安装及使用
- linux下git的安装和使用
- Linux下git的安装与使用
- linux下git的安装和使用
- linux下git安装使用
- Mac下安装git 及git在xcode中的简单使用
- 【Git】Linux下的Git简单管理
- windows下git客户端的下载安装及使用教程
- Linux下Memcache的使用及安装
- linux下mongodb的安装及使用
- linux下Webbench的安装及使用
- hdu 1279
- Mybitas配置
- 【C++】时间复杂度
- 对软件产品化的理解
- IEEE二进制浮点数算术标准(IEEE 754)
- Linux下git的安装及简单使用
- 《Python编程》笔记(七)
- 用JS实现图片剪裁效果并预览
- “单例模式”文章收藏
- hibernate中一对一映射配置详细解析(二)
- java反射机制
- Android插件化原理解析——ContentProvider的插件化
- ORACLE数据库误操作执行了DELETE,该如何恢复数据?
- 数据库 左连接 右连接 全连接用法小结