博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

文章分类 -  GIT

摘要:http://liuhui998.com/2010/11/06/remove_commits_completely/ 如何彻底删除 git 中的提交(commit) 原来我写一博文,说如何如何找回git 中丢失的提交(commit)。当时有人问我,是不是执行 git gc 后那些悬空对象(dangl 阅读全文

posted @ 2022-04-13 17:26 bw_0927 阅读(2181) 评论(0) 推荐(0)

摘要:git config --global color.status auto git config --global color.diff auto git config --global color.branch auto git config --global color.interactive  阅读全文

posted @ 2021-08-25 11:13 bw_0927 阅读(153) 评论(0) 推荐(0)

摘要:git config --global http.proxy http://user:password@http://10.10.10.10:8080 特殊字符要url编码,例如!, %21 git config --get --global http.proxy git config --glob 阅读全文

posted @ 2021-08-02 10:21 bw_0927 阅读(374) 评论(0) 推荐(0)

摘要:https://kevin-richael.github.io/2018/02/03/git-cached/ blog (当前目录) ├ .git ├ source ├ themes ┊ ├ next ┊ ┊ ├ .git ┊ ┊ ├ test ┊ ┊ ├ etc. 因为next下已经有git仓库了 阅读全文

posted @ 2021-03-08 17:00 bw_0927 阅读(226) 评论(0) 推荐(0)

摘要:Push an existing folder cd existing_folder git init git remote add origin git@gitlab.xxxx.com:bw/xxxx.git git add . git commit -m "Initial commit" git 阅读全文

posted @ 2020-12-14 10:16 bw_0927 阅读(786) 评论(0) 推荐(0)

摘要:使用Git下载指定分支命令为:git clone -b 分支名仓库地址 git clone --depth=1 xxxx 浅下载 //只会下载master分支 这样的克隆的一个限制是你不能将它推入新的存储库。 需要重新下载整个仓库 git pull --unshallow origin develo 阅读全文

posted @ 2019-09-24 18:36 bw_0927 阅读(1235) 评论(0) 推荐(0)

摘要:问题: 在使用git进行版本控制的过程中发现,将想被忽略的文件(文件夹)配置到.gitignore文件中后,实际修改了想被忽略的文件,调用git status查看时,仍然会提示提交这些文件。也就是说实际并没有被忽略 原因: 原因是git ignore只会对不在git仓库中的文件进行忽略,如果这些文件 阅读全文

posted @ 2018-06-16 15:38 bw_0927 阅读(130) 评论(0) 推荐(0)

摘要:对比不同分支的文件差异 git difftool master:/path/to/file /path/to/file 从其它分支提取文件 git checkout [branch] -- [file # 删除 untracked files git clean -f # 连 untracked 的 阅读全文

posted @ 2018-01-25 11:07 bw_0927 阅读(178) 评论(0) 推荐(1)

摘要:git rebase --onto master 76cada^ git checkout master git merge feature_branch 把其他分支76cada之后的commit都合并到master分支上。 merge会生成一个新的提交,有菱形存在,不好 。但commit id保留 阅读全文

posted @ 2018-01-05 15:34 bw_0927 阅读(265) 评论(0) 推荐(0)

摘要:查看分支是基于哪个分支checkout出来的 git reflog --date=local | grep 'ppc_9.26' 首先,每条线都是一个 branch(分支),每个点都是一次 commit(提交记录) 1. 使用Git log命令 说明: --decorate 标记会让git log显 阅读全文

posted @ 2017-12-27 10:33 bw_0927 阅读(10092) 评论(0) 推荐(0)

摘要:git-cherry - Find commits not merged upstream git cherry [-v] [<upstream> [<head> [<limit>]]] 2,查看到未传送到远程代码库的提交描述/说明git cherry -v 阅读全文

posted @ 2017-12-21 16:30 bw_0927 阅读(217) 评论(0) 推荐(0)

摘要:http://blog.csdn.net/ybdesire/article/details/42145597 可以先cherry-pick特定的几个commit,稍后再用rebase进程批量的合并。cherry-pick的commit的id会发生变化,所以git log branch1 ^branc 阅读全文

posted @ 2017-08-10 18:09 bw_0927 阅读(412) 评论(0) 推荐(1)

摘要:git stash git stash list git stash pop git stash clear git stash drop stash@{1} git stash show -p stash@{1} 查看stash的内容修改 阅读全文

posted @ 2017-07-31 17:13 bw_0927 阅读(99) 评论(0) 推荐(0)

摘要:查看分支是基于哪个分支checkout出来的 git reflog --date=local | grep 'ppc_9.26' git branch -vv git checkout 实际上是修改HEAD文件的内容,让其指向不同的branch。HEAD文件指向的branch就是当前branch. 阅读全文

posted @ 2017-07-18 14:47 bw_0927 阅读(223) 评论(0) 推荐(0)

摘要:git diff hash1 hash2 --stat test | 4 ++-- test2 | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) git diff <local branch> <remote>/<remote bran 阅读全文

posted @ 2017-07-17 11:30 bw_0927 阅读(788) 评论(0) 推荐(0)

摘要:Git 使用的标签有两种类型:轻量级的(lightweight)和含附注的(annotated)。轻量级标签就像是个不会变化的分支,实际上它就是个指向特定提交对象的引用。而含附注标签,实际上是存储在仓库中的一个独立对象,它有自身的校验和信息,包含着标签的名字,电子邮件地址和日期,以及标签说明,标签本 阅读全文

posted @ 2017-07-17 11:25 bw_0927 阅读(170) 评论(0) 推荐(0)

摘要:基于远程分支"origin",创建一个叫"mywork"的分支。 git checkout -b ac_branch origin/ac_branch git checkout <branch name> -- path 把其他分支的文件拷贝到当前分支 git clone 到本地是远程的master 阅读全文

posted @ 2017-07-06 10:23 bw_0927 阅读(176) 评论(0) 推荐(0)

摘要:如果发现多commit一个文件 git commit --amend git会提示你使用 "git reset HEAD^1 <file>..." to unstage 来回退特定的某个文件 完成后再次commit --amend 阅读全文

posted @ 2017-06-30 18:01 bw_0927 阅读(137) 评论(0) 推荐(0)

摘要:https://www.git-tower.com/learn/git/ebook/cn/command-line/advanced-topics/merge-conflicts 执行pull和merge操作时,git都会把执行操作前的HEAD放入ORIG_HEAD中,以防回滚操作。 git res 阅读全文

posted @ 2017-06-20 17:36 bw_0927 阅读(127) 评论(0) 推荐(0)

摘要:http://www.cnblogs.com/my_life/category/636271.html 远程仓库实际上和本地仓库没啥不同,纯粹为了7x24小时开机并交换大家的修改。 选定一个目录作为Git仓库,初始化Git仓库: Git就会创建一个裸仓库,裸仓库没有工作区,因为服务器上的Git仓库纯 阅读全文

posted @ 2017-06-06 15:24 bw_0927 阅读(210) 评论(0) 推荐(0)