git-branch

How to keep branches in sync when using Git Flow

做~自己de王妃 提交于 2019-12-06 12:49:38
问题 This is the workflow we currently follow: Finish a feature and merge it into develop branch Create a release branch from develop Run build scripts on release branch Create a pull request to merge the release branch into master Accept the release branch pull request and merge The master branch can then deploy to live server by running deploy command This all works great, except in my Git repo my branches are out of sync master is now behind develop because it doesn't have the merge commits

Get commit where merged branch forked from (with intermediate merge)

旧巷老猫 提交于 2019-12-06 12:34:43
问题 Lets use the latest available git 2.16.2 and tig 2.3.3. cd /tmp && mkdir fit && cd fit git init touch m1 && git add m1 && git commit -m "master 1" touch m2 && git add m2 && git commit -m "master 2" git checkout -b develop touch d1 && git add d1 && git commit -m "develop 1" git checkout master touch m3 && git add m3 && git commit -m "master 3" git checkout develop git merge master --no-edit touch d2 && git add d2 && git commit -m "develop 2" touch d3 && git add d3 && git commit -m "develop 3"

Git submodule track commit but know branch?

邮差的信 提交于 2019-12-06 12:18:50
问题 I am working in a project where we use git submodules for purposes of tracking the code as whole (Several different parts which are released together) so I like the idea that submodules tracks a specific commit since what submodules will mostly be used for are history purposes. This is nice so that in the future one can checkout a specific tag of the super repo and find out where the code was at for each component. An issue arises though if all of a sudden you want to perform some more

Cleaning remote Git branches

随声附和 提交于 2019-12-06 10:54:59
问题 I have moved an SVN repo to Git and probably due to a number of clonings, I'm now left with a bunch of branches that look like BranchA origin/BranchA remotes/BranchA remotes/origin/BranchA remotes/origin/origin/BranchA i.e. the same branch is listed a number of times. How can I clean this mess up. There are > 50 branches, some are not needed at all, and for the rest I'd be happy with just having them once. EDIT: This is what git remote show origin looks like for a certain case: Remote

How to find out what files were changed in a git branch (not the difference between two branches)

…衆ロ難τιáo~ 提交于 2019-12-06 08:26:05
I have a branch named feature_219 which was created from master a little while ago. Since the diversion, there were a number of files changed on both the branches. Now I am trying to figure out what files where changed while working on the feature_219 branch only. After doing some research I found out that git diff --name-only master feature_219 might help but it turned out that this commands tells about all files that are different in both the branches. I tried to look for some option with this command but nothing worked for me. Is there any way to list only those files that were changed in

Move uncommitted changes from current branch to another branch that conflicts with those changes

我怕爱的太早我们不能终老 提交于 2019-12-06 06:06:15
Suppose I am on branch master and I start making some changes. I make the changes to a file which is already opened in Emacs (so under the hood, as checkouts happen, Emacs is unaware unless I revert-buffer constantly). The file did exist in branch other_branch which was intended to be merged into master later on. But the file did not exist in master until I accidentally saved it from Emacs. The changes are uncommitted, but I realize that I shouldn't have been making the changes on master and had intended to checkout a different branch before starting on the changes. I don't want to lose the

Can I push a commit made in detached HEAD state

Deadly 提交于 2019-12-06 03:57:22
问题 Using git I would like to go into detached HEAD state and create a new commit. I'd then like to create a tag and push both the 'detached commit' and the tag to the remote repo. Is this possible? If I create the detached commit in my local repo and create a tag then I can checkout the tag to get back to that state. I'd like to share that with the remote repo so that other uses can clone the repo and checkout the tag and get to that same state. The reason I want to do this is because the build

Error on branch creation: “warning: refname 'master' is ambiguous.”

十年热恋 提交于 2019-12-05 23:41:06
问题 I've had simple project being managed in a Git repository. To date I haven't intentionally created any branches, but when I tried to create my first today using $ git branch mybranch I see this error: warning: refname 'master' is ambiguous. fatal: Ambiguous object name: 'master'. Digging deeper: $ git branch -a * master remotes/master/HEAD -> master/master remotes/master/master Is this normal to see in Git? Have I cloned my repository incorrectly? What is the best way to resolve this problem?

How to remove unnamed branch in git shown in Github network view

北城余情 提交于 2019-12-05 20:49:17
In the Github's network view of my git repository, there is a "phantom" branch that has no name. Please see the picture below. For the sake of simplicity I would like to remove the black branch (leaving only the blue branch). How can this be done? Some of the labels with the hash: Assume the black branch starts at Commit A, and ends at Commit Z. Both A and Z are the blue dots. In the cmd, A and Z are the commit sha1. git rebase --onto Z^2 A master This makes a linear history. But if doing so, you must git push origin -f master:master to update the remote master by force and inform every member

How to resolve ambiguity between branch name and commit hash in git?

廉价感情. 提交于 2019-12-05 20:37:15
问题 I have a branch named 0726b and I want to diff my current working copy with that branch. Apparently there is also a commit that has a hash starting with that very sequence, because I get $ git diff 0726b warning: refname '0726b' is ambiguous. How do I tell git that it should take the argument as a branch name? 回答1: Try this: git diff refs/heads/0726b refs/heads/0726b specifies a branch named 0726b . The file ./git/refs/heads/0726b contains the commit hash that this branch points to. 来源: https