文档:https://git-scm.com/docs

列出所有远程空间:

git remote -v

重命名远程空间:

git remote rename <old> <new>

删除远程空间:

git remote remove <name>

列出所有分支(本地+远程):

git branch -a

查看本地与远程分支对应关系:

git branch -vv

关联本地与远程分支:

git branch -u <远程空间/远程分支> [<本地分支>]

当远程空间刚刚建立,没有分支时,push出一个并建立关联:

git push -u <远程空间> <远程分支>

修改首个提交:

git checkout --orphan new_master #新建一个干净的临时分支
# 添加文件
git commit -m "new initial commit" #提交。这应当是我们期望的首次提交的样子
git checkout master #切换到想修改的分支
git reset --hard new_master #使它变得与临时分支一模一样
git branch -D new_master #删除临时分支

偶尔要用的git命令备忘的更多相关文章

  1. git 命令备忘

    git 常用命令备忘 仅作为日常使用备忘,并非常用命名整理 删除源端分支 git push orgin --delete branch_a a分支某次提交应用到b分支 切换到branch_b 分支: ...

  2. Git命令备忘

    最近在用Git,查了点相关资料,逻辑依然不太明了,先整理一部分备忘,以后补充 一.本地Git与Github/码云的关联 1. 设置本地用户名,邮箱 git config --global user.n ...

  3. metasploit 常用命令备忘

    metasploit 常用命令备忘    MSFconsole Commands-------------------------------------24show exploits 查看所有exp ...

  4. git使用备忘

    简单的记录下现在使用git的时候,暂时或者常用到的命令,纯粹自己备忘,没用到过的命令就不写了,日后有用到了在补充. 1.把远程仓库克隆到本地:git clone 远程地址 2.分支操作 新建分支:gi ...

  5. Vi命令备忘

    备忘 Ctrl+u:向文件首翻半屏: Ctrl+d:向文件尾翻半屏: Ctrl+f:向文件尾翻一屏: Ctrl+b:向文件首翻一屏: Esc:从编辑模式切换到命令模式: ZZ:命令模式下保存当前文件所 ...

  6. 实用Shell命令备忘

    开场白:这里简单记录一些常用的bash命令,一则备忘,二来希望可以帮助别人解决一些问题. 1.检测文件是否存在 if [ -f ./foo.txt ] then echo the file exist ...

  7. 常用linux命令备忘

    备忘: 关闭防火墙:# systemctl stop firewalld 查看防火墙状态:#  systemctl status firewalld 停止防火墙:#  systemctl disabl ...

  8. Git学习备忘

    本文参考廖雪峰写的精彩的git学习文档,大家可以直接去官网看原版,我这里只是便于自己记录梳理 原版地址:http://www.liaoxuefeng.com/wiki/0013739516305929 ...

  9. GIT常用命令备忘

    Git配置 git config --global user.name "storm" git config --global user.email "stormzhan ...

随机推荐

  1. 一些VMware vCenter Appliance的默认用户名和密码

    一些VMware vCenter Appliance的默认用户名和密码 2014-03-30 17:30:03 flowershade_21 阅读数 13367更多 分类专栏: vmware   VM ...

  2. Greenplum 表空间和filespace的用法

    转载:https://yq.aliyun.com/articles/190 Greenplum支持表空间,创建表空间时,需要指定filespace.postgres=# \h create table ...

  3. MongoDB之安装部署

    一.安装MongoDB 在安装MongoDB之前,应该先把MongoDB官方网站上下载下来,下载的地址如下: https://www.mongodb.com/download-center 下载完毕之 ...

  4. python 使用PyKDL 四元数转欧拉角

    安装: sudo apt-get install ros-indigo-kdl-parser-py 使用: import PyKDLimport math def quat_to_angle(quat ...

  5. python3编程基础之一:代码封装

    几乎现代的编程语言都支持函数,函数是代码段的封装,并能实现一特定功能,并能重复使用的代码单位.之前的pow()和sqrt()和print()和input()等类似的内置函数,就是python内部已经实 ...

  6. ShardingSphere Hint模式 SpringBoot + Mybatis

    ShardingSphere Hint模式不需要对sql进行解析,就可以进行数据库或者表的路由.下面贴一下代码,关于SpringBoot + Mybatis + ShardingSphere怎样结合. ...

  7. hdu4283

    You Are the One Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  8. Homebrew 使用国内镜像

    在国内的网络环境下使用 Homebrew 安装软件的过程中,可能会长时间卡在 Updating Homebrew ... 方法一:按command + c 取消本次更新操作,直接安装软件 方法二:设置 ...

  9. numpy模块-渐入佳境

    1.多维数组降为一维: numpy中的ravel().flatten().squeeze()的用法与区别 2. axis的理解 Python之NumPy(axis=0/1/2...)的透彻理解——通过 ...

  10. [软工]Github的使用

    注册 修改个人信息 fork项目 使用github客户端 commit项目 发送PR 注意事项 不要使用上述项目进行试验 建议Github用户名有规律,好记忆