git-merge

Git branch has diverged after rebase, so why rebase?

心已入冬 提交于 2019-12-03 05:54:49
问题 Recently I came across the notification that my branch has diverged. That was when I made a feature branch, pushed it to remote, and did a rebase with master a few days later when I started working on it again. git checkout -b feature-branch git push origin feature-branch:feature-branch ...and when in master... git pull origin master git checkout feature-branch git rebase master But when I want to push my branch again, it says: On branch feature-branch Your branch and 'origin/feature-branch'

Git warning: refname 'xxx' is ambiguous

浪子不回头ぞ 提交于 2019-12-03 05:50:53
I have two branches 'master' and 'develop', I create a new branch from master that 'hotfix-1' and then I merge 'hotfix-1' back to master with ; git checkout master git merge --no-ff hotfix-1 Created a tag for this point; git tag -a hotfix-1 -m "" and then I switched back to develop branch from master and merge 'hotfix-1' with ; git checkout develop git merge --no-ff hotfix-1 after merging 'hotfix-1' to develop I'm getting "warning: refname 'hotfix-1' is ambiguous" message and it's successfully merging my changes to develop too.. should I worry about anything ? Edit git show-ref --heads --tags

List merge commits affecting a file

末鹿安然 提交于 2019-12-03 04:52:19
问题 I want to find all the merge commits which affect or involve a given file. For background, someone mis-resolved a conflict when merging, and it wasn't noticed by the team for a few days. At that point, a lot of other unrelated merges had been committed (some of us have been preferring to not use rebase, or things would be simpler). I need to locate the "bad" merge commit, so it can be checked to identify what else might have been reverted (and, of course, to identify and punish the guilty).

what does git merge origin/master do?

倾然丶 夕夏残阳落幕 提交于 2019-12-03 04:16:48
问题 After fetching from remote using git fetch , we need to use something like git merge origin/master I would like to know if this command also does git commit at the same time? Is the order origin/master important? Can I write master/original ? 回答1: git merge origin/master can do one of two things (or error). In the first case, it creates a new commit that has two parents: the current HEAD , and the commit pointed to by the ref origin/master (unless you're doing something funny, this is likely

Abort a Git Merge

本秂侑毒 提交于 2019-12-03 04:05:00
问题 I am working on a project using Git as the VCS. I got a branch xyz cut from the mainline branch of master. After working for a while, I committed my code and took a pull of the branch mainline. The pull was fine. I then merged the code with master. After the merge, there were problems in certain files. I have not committed the code after merging. Can someone please guide as to how I can abort this merge and bring my branch where I am working currently to the state where it was before I merged

Git pull - Please move or remove them before you can merge

不羁岁月 提交于 2019-12-03 04:04:33
问题 I am trying to do a git pull origin master from my server but keep getting the error: Please move or remove them before you can merge. There are no untracked files, but it seems like it has issues with the ignored files for some reason. I tried running a git clean -nd to see what would be deleted and it lists a whole bunch of files that are ignored in .gitignore . How can I fix this so I can do a pull? 回答1: Apparently the files were added in remote repository, no matter what was the content

Managing local-only changes with git

我的梦境 提交于 2019-12-03 03:04:18
On my local branch, I have some personal (local-only) changes to a Makefile (just changing the path to the compiler). Obviously I don't want to commit those changes in as they are only relevant to me. However, if I don't commit them then I get an error when I try to sync with the remote branch: % git fetch upstream % git merge upstream/master error: Your local changes to 'Makefile' would be overwritten by merge. Aborting. Please, commit your changes or stash them before you can merge. Stashing and then un-stashing the file every time this happens seems tedious. On Perforce for example, you

Git: How to properly merge two functional and quite different branches?

被刻印的时光 ゝ 提交于 2019-12-03 02:57:30
Imagine a situation where you have two branches of the same project, with one part of the first branch dramatically refactored over the other one. But for a while you need to keep both branches functional, so you are doing bug fixes and crucial feature additions to both of them, sometimes in a not symmetrical way. And at some point there comes a moment when you have to merge refactored branch onto the original one. What is the best technique to use in a situation like this? Is it still possible to keep the history clean? But more importantly what should have been my initial strategy in such

Git - Different Remote for each Branch

旧时模样 提交于 2019-12-03 02:38:59
问题 I'm unsure of how to ask this properly but I'll try and do my best - I'm by no means a Git aficionado, I know how to use the basic commands but not advanced terminology/functionality. I have a private repository myrepo cloned from a private server git.mydomain.com . I'm familiar with the process of branching code on the same repository with git checkout -b mybranch - however I'd like to branch to GitHub rather than my private server, resulting in something like this: Repo Branch Remote

Git: best way to remove all changes from a given file for one branch

感情迁移 提交于 2019-12-03 02:29:15
I have a bit of a messy branch with 20 or so commits, and I'm preparing for a merge back to master. I've rebased it off master, and looking closer, I realise that there are files being modified in ways that are totally irrelevant to this branch, and not ready to be committed. The changes to those files aren't confined to specific commits. So basically, I don't want anything to do with those files to be included in this branch if possible. Is there a good way to go about this? My fall back position #1 is obviously to just copy over the latest copy of each of those files then commit. But then