git_cmd和gihub使用说明
来源:互联网 发布:uncomtrade数据库 编辑:程序博客网 时间:2024/06/04 19:39
1 复制
github使用说明://首先在本地创建ssh key$ ssh-keygen -t rsa -C "your_email@youremail.com"//后面的your_email@youremail.com改为你的邮箱,之后会要求确认路径和输入密码,我们这使用默认的一路回车就行。成功的话会在~/下生成.ssh文件夹,进去,打开id_rsa.pub,复制里面的key。//回到github,进入Account Settings,左边选择SSH Keys,Add SSH Key,title随便填,粘贴/home/xxx/.ssh/id_rsa.pub(公匙)。为了验证是否成功,在git bash下输入://测试github$ ssh -T git@github.com//配置本地GIT$ git config --global user.name "your name" $ git config --global user.email "your_email@youremail.com" //获取Git配置信息,执行以下命令git config --list//以下命令会为终端配置高亮git config --global color.status autogit config --global color.branch auto//向github推送文件$ mkdir test //创建目录$ cd test //进入目录$ git init //创建./.git$ vi README$ git add README //向git增加文件或者目录$ git add xx/ //add 目录,不能少“/”$ git commit -m 'first commit' //向local./.git 提交$ git remote add origin git@github.com:jiangdoudou/test.git //必须先在github创建“Repositories”!!//git remote -v //git remote add xxxx ->xxxx表示分支名$ git push -u origin master //向github 推送//要为本地分支设定不同于远程分支的名字,只需在前个版本的命令里换个名字:$ git checkout -b new_local_branch_name origin/serverfix//git branch 此处githubused 分支时增加!!!!!//向github 提交分支$ git branch xxxx //xxxx表示分支名$ git checkout xxxx //切换分支到xxxx$ git branch//直接输入git branch,不加任何后续参数,就表示让git列出所有已存在的分支$ git push origin githubused //githubused 为分支名//#################################################################################//×××××××××××××××××××××××××××××删除文件并提交×××××××××××××××××××××××××××××××××××××在Git中,删除也是一个修改操作,我们实战一下,先添加一个新文件test.txt到Git并且提交:$ git add test.txt$ git commit -m "add test.txt"[master 94cdc44] add test.txt 1 file changed, 1 insertion(+) create mode 100644 test.txt//#################################################################################//×××××××××××××××××××××××××××××本地更新,提交分支×××××××××××××××××××××××××××××××××××××//提交分支将user1/getopt分支合并到主线(1),为将分支合并到主线,首先user1将工作区切换到主线,master分支.[root@localhost src]# git checkout master切换到分支 'master'(2)然后执行git merge命令以合并user1/getopt 分支.[root@localhost src]# git merge user1/getopt更新 d901dd8..733dcf6(3)本次合并非常顺利,实际上合并后master分支和user1/getopt指向同一个提交 ,这是因为合并前的master的提交就是user/getopt分支的父提交,所以此次合并相当于将分支master重置到user1/getopt分支[root@localhost src]# git rev-parse user1/getopt master733dcf67eba976a61d0dc6396c9d23cb23568591//=========================github提交大于100MB文件错误时==================================//remote: error: File binaries/debian-server-rootfs.tar.gz is 235.00 MB; this exceeds GitHub's file size limit of 100.00 MB$ git filter-branch -f --index-filter "git rm -rf --cached --ignore-unmatch binaries/debian-server-rootfs.tar.gz" -- --all
2# 恢复commit 记录 不含分支
a,查看所有commit记录(包含rm)
--> $ git reflog
eb0ae3b HEAD@{7}: commit: add zhaodian_USB_TP 21.5
1fadaa1 HEAD@{8}: commit: add for m180_v3 IR KEY_DOU KEY_F1_into_Settings.apk 20150916
b, 恢复commit 到当前分支
--> $ git cherry-pick 63ee78
3,
4,
5,
0 0
- git_cmd和gihub使用说明
- Git和Gihub入门
- showModalDialog和showModelessDialog使用说明
- EXPDP和IMPDP使用说明
- patch和diff使用说明
- EXPDP和IMPDP使用说明
- 虚拟机下载和使用说明
- EXPDP和IMPDP使用说明
- EXPDP和IMPDP使用说明
- EXPDP和IMPDP使用说明
- EXPDP和IMPDP使用说明
- EXPDP和IMPDP使用说明
- EXPDP和IMPDP使用说明
- EXPDP和IMPDP使用说明
- EXPDP和IMPDP使用说明
- ViewPager介绍和使用说明
- ViewPager介绍和使用说明
- EXPDP和IMPDP使用说明
- 集合的全排列问题-递归实现方式的改进---旋转法
- 使用SQLAzureMW进行迁移
- 使用JQUERY实现JSON数据三级联动
- WifiManager 常量
- 【工作记录0012】highcharts 选中 连续数据点 并求 Y轴值总和 的实现
- git_cmd和gihub使用说明
- jsp的九大内置对象
- 动效设计整理
- View(一)
- [LeetCode] Container with most water
- 一些基础算法(1)
- C#中yield return用法分析
- Firefox OS启动过程分析-b2g进程启动
- 创建桌面快捷方式