branch

Do we really need to branch in Git?

微笑、不失礼 提交于 2020-06-22 22:56:27
问题 I'm in my first software engineering class. It's the first time any of us has worked in a team and used git and github. In class our teacher told us that you should usually branch off the master, after you finish your new feature, merge it back to the master. This is what I've been doing. However the other members of my group are not branching. They pull from the master on github to their local machine, make edits, finish their feature on their local master, then push to the master on github.

Do we really need to branch in Git?

那年仲夏 提交于 2020-06-22 22:55:35
问题 I'm in my first software engineering class. It's the first time any of us has worked in a team and used git and github. In class our teacher told us that you should usually branch off the master, after you finish your new feature, merge it back to the master. This is what I've been doing. However the other members of my group are not branching. They pull from the master on github to their local machine, make edits, finish their feature on their local master, then push to the master on github.

Git: How to list commits on a merged branch?

久未见 提交于 2020-05-27 05:00:19
问题 This is the inverse of how to list commits on a branch but not merged branches, so I'll ask it in the same format. Let's say my git commit history looks like this: A---B---C---D---E---F master \ / X---Y---Z topic How do I list the commits on the topic branch -- that is, X , Y , and Z ? Note that simply doing git log topic won't work -- that will return commits A and B as well. I had thought I could run git merge-base topic master to find B , and then do git log B..Z to get these commits.

Workflow for Using Django South with Multiple Code Branches

一世执手 提交于 2020-05-09 17:46:39
问题 I'm curious as to how other Django devs manage their database migrations with South when developing with multiple code branches. Let me give a sample scenario. Say for example you start you development with your main trunk. You create Branch A from the trunk. At this point, the last migration version for app_1 is 0010. Then you create a migration for app_1 in the trunk that creates a migration file 0011_add_name_column . Meanwhile, in branch A, another developer creates a different migration

Update a local branch with the changes from a tracked remote branch

廉价感情. 提交于 2020-04-07 10:50:27
问题 I have a local branch named ' my_local_branch ', which tracks a remote branch origin/my_remote_branch . Now, the remote branch has been updated, and I am on the ' my_local_branch ' and want to pull in those changes. Should I just do: git pull origin my_remote_branch:my_local_branch Is this the correct way? 回答1: You have set the upstream of that branch (see: "How do you make an existing git branch track a remote branch?" and "Git: Why do I need to do --set-upstream-to all the time?" ) git

Update a local branch with the changes from a tracked remote branch

霸气de小男生 提交于 2020-04-07 10:50:26
问题 I have a local branch named ' my_local_branch ', which tracks a remote branch origin/my_remote_branch . Now, the remote branch has been updated, and I am on the ' my_local_branch ' and want to pull in those changes. Should I just do: git pull origin my_remote_branch:my_local_branch Is this the correct way? 回答1: You have set the upstream of that branch (see: "How do you make an existing git branch track a remote branch?" and "Git: Why do I need to do --set-upstream-to all the time?" ) git

设计模式-组合模式

╄→гoц情女王★ 提交于 2020-04-07 07:50:07
组合模式(Composite Pattern)也叫合成模式,有时又叫做部分-整体模式(Part-Whole), 主要是用来描述部分与整体的关系: 定义: Compose objects into tree structures to represent part-whole hierarchies.Composite lets clients treat individual objects and compositions of objects uniformly.(将对象组合成树形结构以表示“部分-整体”的层次结构,使得用户对单个对象和组合对象的使用具有一致性。) 举个最常见的例子,公司组织架构就是一个典型的树状结构(网上截取图): image.png 我们一般会这样设计组织架构,看代码实现 首先根节点IROOT /** * 根节点 * @author shuliangzhao * @Title: IRoot * @ProjectName design-parent * @Description: TODO * @date 2019/6/18 22:37 */ public interface IRoot { //得到总经理的信息 public String getInfo(); //总经理下边要有小兵,那要能增加小兵,比如研发部总经理,这是个树枝节点 public void

Git 处理tag和branch的命令

亡梦爱人 提交于 2020-04-07 03:50:03
最近想给GitHub 上的项目设置tag,可是使用GitHub Desktop,找了一圈都没找到快速设置Tag 的地方,最后只能通过终端命令来添加了。 想要查看Git 的命令,可以使用 git --help 可是大致看一下git的命令: These are common Git commands used in various situations: start a working area (see also: git help tutorial) clone Clone a repository into a new directory init Create an empty Git repository or reinitialize an existing one work on the current change (see also: git help everyday) add Add file contents to the index mv Move or rename a file, a directory, or a symlink reset Reset current HEAD to the specified state rm Remove files from the working tree and from the index examine

git使用笔记-基础篇

…衆ロ難τιáo~ 提交于 2020-04-07 03:11:43
git使用手册:https://git-scm.com/book/zh/v1/ 一、分支   1、查看所有本地分支     git branch   2、查看所有本地分支和远程分支     git branch -a   3、查看本地分支和远程分支的对应关系     git branch -vv   4、查看远程分支对应远程库路径    git remote -v   5、创建/删除本地分支     git branch local-name 以当前分支为基础创建名为local-name的本地分支     git checkout -b local-name 以当前分支为基础创建本地分支local-name并切换到该分支     git branch -d 如果有未合并的提交,不会删除     git branch -D 强制删除,如果有未合并的提交也删除   6、设置本地分支与远程分支的追踪关系    git branch --set-upstream-to=远程库名/分支名   7、以远程库为基础创建本地分支     git checkout -b localbranch remotebranch 创建本地分支,以remotebranch为开始。同时也建立了本地分支和远程分支的关系。     该方法与5相比更加方便,因为5是以当前分支为基础创建新分支,而远程分支是其他分支

git 实践(一) pull的使用

限于喜欢 提交于 2020-04-07 02:23:09
前言 工作中,我们会用到 git pull 来从远程仓库"同步"代码,通常有三种方式; git pull origin <remote_branch>:<local_branch> git pull origin <remote_branch> git pull 这三种用法充分诠释了什么是 简即繁 , 繁即简 ;看上去简单的,往往背后蕴藏玄机; 测试环境: 本地分支:master和dev 远程分支:master和dev $ git branch -a * dev master remotes/origin/HEAD -> origin/master remotes/origin/dev remotes/origin/master 1.git pull origin <remote_branch>:<local_branch> 这种用法写起来最为繁琐,但最好理解: 场景:当本地的当前分支不是local_branch; 作用:将远程分支拉取到指定本地分支; 例如:当前分支是dev,但是你想把远程master”同步”到本地master,但又不想使checkout切换到master分支; 这时你就可以使用git pull origin master:master zhangchangzhi@ZBXXXX /e/02.Workspace-test/gitTest (dev) $ git