branch

Switch to another branch without changing the workspace files

徘徊边缘 提交于 2019-12-04 07:39:08
问题 I cloned a git repository from GitHub, made some changes and some commits; I made quite a lot and all are quite dirty, so they're not suitable for a pull request. Now I created the branch cleanchanges from origin/master , so it's clean, and I want to commit my changes there as one commit with a nice commit comment. When I am on the local master, I want to switch to my cleanchanges but without changing the files. And then I'm able to commit. How can I switch branches without changing files? I

Pushing to a remote branch (failed to update ref)

狂风中的少年 提交于 2019-12-04 07:33:56
I have a remote repository with a feature/initital-change branch. Now I want to push some files to this remote branch from my local feature/initital-change branch. I went through a few posts on pushing to remote branches and tried out a few methods but I am still getting the same error. After adding and committing, I get the following for git status. Sakibs-MacBook-Pro:BluFireLabs SakibArRahman$ git status On branch feature/initial-change Your branch is ahead of 'origin/feature/initial-change' by 1 commit. (use "git push" to publish your local commits) nothing to commit, working directory

Showing commits made directly to a branch, ignoring merges in Git

给你一囗甜甜゛ 提交于 2019-12-04 07:30:43
问题 When using git, is there a way to show commits made to a branch, while ignoring all commits that were brought in by merging? I'm trying to review the code changes made on a branch while ignoring the ones we made on other branches that were merged in. I know it's damn near impossible to show a diff in that fashion, but I'd like to be able to find out which commits I need to review. 回答1: --no-merges Both parents have equal weight in many contexts in git. If you've always been consistent in

本地项目添加到git上

浪子不回头ぞ 提交于 2019-12-04 07:26:32
一、首先添加本地设置ssh公钥配置: 1. 配置用户名和邮箱 $ git config --global user.name "your_name" $ git config --global user.email "your_email@example.com" 2. 生成密钥对 ssh-keygen -t rsa -b 4096 -C "your_email@example.com" 3. 登录 github ,打开 id_rsa.pub 把里边的内容复制到ssh的公钥配置里边 4. 在终端进入到本地项目目录,输入 git init 5. $ git remote add origin "仓库ssh地址" //本地添加远程仓库 命名为 origin 6. git add . , git commit -m ' xxx' 7. git branch --set-upstream-to=origin/<branch> master //本地 master 分支 追踪到远程branch分支 8. git pull origin master --allow-unrelated-histories //强制关联本地和远程库 9. git branch -m <branch> //修改当前分支名 保持和线上一直 10. git pull 11. git push /*--> */ /*-

How to discard all changes made to a branch?

泄露秘密 提交于 2019-12-04 07:21:34
问题 I'm working in a branch (i.e. design ) and I've made a number of changes, but I need to discard them all and reset it to match the repository version. I thought git checkout design would do it, but it just tells me I'm already in branch design and that I have 3 modified files. How would I discard those changes and get the branch as it stands now on the remote server? 回答1: Note: You CANNOT UNDO this. Try git checkout -f this will discard any local changes which are not committed in ALL

Git使用基础(二)

好久不见. 提交于 2019-12-04 07:20:27
1. 查看当前所在分支与本地所有分支,前缀*的分支为当前所在分支 git branch 2. 查看branch命令帮助文档,在linux或macos中会在当前终端打开帮助文档,在windows中会自动启动默认浏览器并打开文档 git branch --help 3. 从当前分支创建新分支 git branch (新分支名称) 4. 切换到指定分支 git checkout (指定分支名称) 5. 删除指定分支 git branch -d (指定分支名称) // 未合并到主分支或其他分支,会禁止删除 6. 强制删除分支,操作必须谨慎 git branch -D (指定分支名称) 7. 合并分支,将指定分支合并到当前分支 git merge (指定分支名称) 8. 修改指定分支 git branch -m (指定分支名称) 来源: https://www.cnblogs.com/devinzh/p/11846336.html

Can I safely rebase one branch into other and then to master?

这一生的挚爱 提交于 2019-12-04 06:29:01
问题 I have to development branches and I found branch B depending on code from branch A . I want to rebase A into B so I can keep on developing B . Soon A will be merged to master (before B ), but not now. Then, when I merge B , will it break the reference from having A rebased on it? Can I just then rebase B on master and all will be fine or do I need to do any special step? 回答1: Note that git (and pretty much all other version control systems) calls this rebasing on to, not in to. You may

HLSL branch avoidance

为君一笑 提交于 2019-12-04 06:16:47
I have a shader where I want to move half of the vertices in the vertex shader. I'm trying to decide the best way to do this from a performance standpoint, because we're dealing with well over 100,000 verts, so speed is critical. I've looked at 3 different methods: (pseudo-code, but enough to give you the idea. The <complex formula> I can't give out, but I can say that it involves a sin() function, as well as a function call (just returns a number, but still a function call), as well as a bunch of basic arithmetic on floating point numbers). if (y < 0.5) { x += <complex formula>; } This has

使用TortoiseSVN进行分支管理

半腔热情 提交于 2019-12-04 06:12:00
SVN中的Branch/tag在一个功能选项中,在使用中很容易产生混淆。 分支(Branch)管理和标记(Tag)管理,版本管理系统有两个基本的功能。 分支用于在并行开发,这里的并行是指和trunk(主分支)的并行。 而tag是用来做一个里程碑(milestone),不管是不是release,都是一个可用的版本。 那么什么时候用到tag管理?什么时候用到Branch管理? 我举两个场景: 场景一,有客户想对产品做定制,但是我们并不想修改原有的svn中trunk的代码。 场景二,我们正在开发产品下阶段的任务,但上阶段的工作发现问题 以场景二为例,项目某一阶段开发完成后,这个时候要做一个tag,tag_mfcai_V1.01.00, 然后基于这个tag发布一个新的版本,假设项目是web项目,那么基于这个tag发布一个war包。 然后trunk进入下阶段继续开发,但是很不幸发布的版本被检测出来了bug,有人会提议,把bug放到下阶段的任务中去。假设下阶段的任务才刚开始,用户可等不起.他们会认为一个小的bug解决要这么长时间,效率太低了. 那么就需要基于tag_mfcai_V1.01.00做一个branch,branch_bugfix_V1.01.00,基于这个branch进行bugfix, 等到bugfix结束,做一个tag,tag名称假设为:tag_mfcai_V1.01.01

How to merge a branch to another branch in GIT?

可紊 提交于 2019-12-04 05:18:42
Let me explain the problem in detail. I have a main git branch on which I created a new side branch bug10101010, now I wan't to merge the bug10101010 to main. So far everything is good. Now I have a different branch of the same product, named legacy. I wan't to merge the bug10101010 to the legacy branch in GIT. Any ideas? I can't just merge it directly, as the branch bug10101010 is spin off from the main branch and in the legacy I need only the diff between the branch bug10101010 and its parent branch. This is hard to do. Git saves merge history, and if you "cherrypick" and point at a commit