branch

Git 原理简谈

亡梦爱人 提交于 2019-12-06 15:22:54
Git 本身是一个对 reference 进行管理的数据库,reference 指的是对原始数据的引用。通过对原始数据的追踪,那么就可以做到对版本的控制。Git 使用一个 DAG 存储了整个的reference,根据DAG 的特性,你不会找到一个环,也就是说对于版本的控制始终是有顺序保证的。 Git 有三个最基本的元素,Commit,Tree 和 Blob。Commit 记录了一次commit需要的信息,作者,comment和指向tree的指针。Tree 是一个指针,指向 Blob 和其他的 Tree,Tree 在逻辑上类似于 Unix 文件系统的文件夹,总对应着当前文件夹的情况。Blob 就是数据本身,例如代码或者其他本身需要追踪的数据。Tree 数据和 Blob 数据在逻辑上类似于文件夹和文件夹下的文件的关系。 Git 使用了SHA值作为文件名,对于三种内置类型的数据,都采用他们的本身计算出的 SHA-1 值作为文件名。为了方便索引,会把 SHA 值的前几个字符当作文件,然后进行索引。所有的文件都存储在 .git/ 目录。 Git 基本的工作模型如下 每一个 branch 会记录了一个对应的 commit,如果有多个 branch 就记录对应的 commit 信息。一次commit在逻辑上代表了一次的版本。每一次的 commit 指向了上一次的commit 和一个 tree

git submoudle vs git subtree

三世轮回 提交于 2019-12-06 15:17:04
git管理子项目 对于一些比较大的工程,为了便于复用,常常需要抽取子项目。通常项目中的共用UI、共用底层逻辑、共用第三方库抽出来做git管理子项目。这时候git提供了两种管理子项目的方式,submodule和subtree。 有人对submodule和subtree的区别做出一个总结: submodule is link; subtree is copy 。 submodule container 与 module 各自都是独立的 git repo submodule需做一次commit 父层repo需将子层的commitID也要推送上去 submodule的坑 submodule更新完后并push,但主repo没push新meta档到服务器上,另一开发者git pull之后submodule会停留在未修改前的版本。 假设一切正常,主repo有最新submodule的变动文件,开发者git submodule update并不会将submodule切到任何branc 大专栏 git submoudle vs git subtree h,所以默认下的submodule的repo会停留在一个detached HEAD(游离状态)。 修改submodule的坑 常见的做法切到 submodule 的目录,然后做修改,然后 commit 和 push。 如果你不慎忘记切换到分支,又做了提交

Clearcase View and Branch explained

帅比萌擦擦* 提交于 2019-12-06 14:55:59
I've recently started working on a new project for which the development team is using ClearCase for version control (the project is coded mostly in java and ExtJs). I'm hearing the terms 'View' and 'Branch' being thrown around a lot - are these terms interchangeable? If not, could you please provide a layman's explanation of a View and a Branch and how they relate to each other. Are Views and Branches particular to ClearCase or are these terms used in other version control systems as well? VonC I'm hearing the terms 'View' and 'Branch' being thrown around a lot - are these terms

Pushed to git bare repo and I can't pull changes from other machines

梦想的初衷 提交于 2019-12-06 14:37:50
I have a git repo on my Dropbox, I am using Ubuntu, I have a project which I've cloned via git clone blablabla/Dropbox/blablabla.git and I've pushed for like 500 times to that but all I can pull now from another machine is like first 400 also my blablabla/Dropbox/blablabla.git file is smaller than my local /var/www/blablabla/.git so I guess some files aren pushed and so it seems when I've cloned blablabla/Dropbox/blablabla.git from another machine so how can I properly push now on the first machine so I can pull from the second I also have branches plus git push dropbox shows Up to date Help?

Git使用

回眸只為那壹抹淺笑 提交于 2019-12-06 14:10:04
一、Git简介 Git(读音为/gɪt/。)是一个开源的分布式版本控制系统,可以有效、高速地处理从很小到非常大的项目版本管理。Git 是 Linus Torvalds 为了帮助管理 Linux 内核开发而开发的一个开放源码的版本控制软件。 分布式相比于集中式的最大区别在于开发者可以提交到本地,每个开发者通过克隆(git clone),在本地机器上拷贝一个完整的Git仓库。 图为git开发过程: 1、Git的功能特性 从一般开发者的角度来看,git有以下功能: 从服务器上克隆完整的Git仓库(包括代码和版本信息)到单机上。 在自己的机器上根据不同的开发目的,创建分支,修改代码。 在单机上自己创建的分支上提交代码。 在单机上合并分支。 把服务器上最新版的代码fetch下来,然后跟自己的主分支合并。 生成补丁(patch),把补丁发送给主开发者。 看主开发者的反馈,如果主开发者发现两个一般开发者之间有冲突(他们之间可以合作解决的冲突),就会要求他们先解决冲突,然后再由其中一个人提交。如果主开发者可以自己解决,或者没有冲突,就通过。 一般开发者之间解决冲突的方法,开发者之间可以使用pull 命令解决冲突,解决完冲突之后再向主开发者提交补丁。 从主开发者的角度看,git有以下功能: 查看邮件或者通过其它方式查看一般开发者的提交状态。 打上补丁,解决冲突(可以自己解决

Create and merge a git branch to an epic branch

断了今生、忘了曾经 提交于 2019-12-06 13:41:31
问题 I am working on a project, for example, SO/bubbleSort and there I need to create an epic branch called feature/version-1 so from this epic branch there are few developers do the development, so for that, they need to create a separate branch from the epic branch. My question is how can we merge those changes and keep the epic branch with the latest changes. I have followed the following steps to do so. Is it correct? The first step checkout to the develop branch git checkout develop Create an

What's best way to work with git on multiple master branch?

有些话、适合烂在心里 提交于 2019-12-06 13:39:08
问题 I have a git repo for my work project. The software is still under development but i have now three different branch "master" each with some little variations (graphical customization and different behaviour). I cannot merge automatically my development branch with these master branch, because every branch is differnet. I read about git cherry-pick but my question is: "is this the right way to work?" I really need this three different version of my project, maybe can i try to separate the

Removing a specific commit in the git history with several branches?

≡放荡痞女 提交于 2019-12-06 11:57:46
I know how to remove a specific commit from the git history with git rebase --interactive . My question concerns the more complex case with a history like this: A--X--B--C--D \ E--F where I would like to remove the commit X . The issue is that in this case there are two or more branches with parents ( B in this case) that have X in their history, so a single git rebase -i will not do the trick (at least I do not know how). Is there a simple way to remove X , or do I have to rely on rebasing all branches on their own, possibly with a shell script? Unfortunately Git doesn't make it easy in this

Routinely sync a branch to master using git rebase

会有一股神秘感。 提交于 2019-12-06 11:07:41
I have a Git repository with a branch that hardly ever changes (nobody else is contributing to it). It is basically the master branch with some code and files stripped out. Having this branch around makes it easy for me to package up a leaner version of my project without having to strip out the code and files manually every time. I have been using git rebase to keep this branch up to date with the master but I always get this warning when I try to push the branch after rebasing: To prevent you from losing history, non-fast-forward updates were rejected Merge the remote changes before pushing

Conditional Logic in django forms

女生的网名这么多〃 提交于 2019-12-06 10:42:48
I'm trying to build a conditional form where selecting one option will cause a new field to appear underneath, while selecting another option will display something else. Formstack has a good example https://www.formstack.com/features/conditional-logic I couldn't find any preexisting form packages for django with this functionality. How should I start implementing this? Django forms (especially if you use the ModelForm library) are a direct reflection of your Django application Model . You should therefore start by refactoring your Django application Model to have fields that have optional