w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Git: How to manage multiple branches on submodule and tie them to particular branches on main repo
It sounds like what you need to do is move the sub-module to a separate repository and use it as an external in the main repository, you can then tag specific versions, (and branches), of the external in the main and vice versa.

Categories : GIT

Understanding How Local Git Branches "Track" Remote Branches
The arrow is just a symbolic ref, showing a layer of indirection between remote origin/HEAD branch and remote origin/master branch. In order to see tracking you need to add a flag to trigger a higher level of verbosity. Here's the output of the same command with the -vv flag. The -vv flag adds verbosity to the output about each branch. Consider the line for the master branch. It now gives the SHA-1 hash of the head commit for the branch, and then, in brackets, it tells us the remote branch that the master branch is tracking -- origin/master. This tracking was established by git when we cloned our local repo; master is the only branch for which tracking is auto configured. Next, I also configured my local bDev branch to track the branch of the same name on the origin remote.

Categories : GIT

Why is merging feature branches into release branches a bad idea?
One case I could think of, where this can make thing go complicated is that it will start blocking further development. Consider you are developing a feature A, which will go immediately on your next release. Now there is another development team which will be working on feature B, which is heavily dependent on feature A, but it needs to be in release only after a couple of sprints. So, obviously we will branch out feature B from feature A. Now, you find a bug in feature A, your release for feature A is approaching fast, you have two options a hot-fix/hack or a proper code re-factor and fix. With time as constraint, its wise to have hot-fix, but considering future we need proper re-factor and fix. Happy news is that we can go for both. With your strategy (from what I understand) you

Categories : GIT

Is it possible to show if git branches have the same commits if the one of the branches has been rebased so they don't have the same SHA1 IDs?
Using git log with the --cherry-mark option will work. Specifically, you can see a set of commits that are the same between a branch A and a branch B with the following: git log --cherry-mark --oneline --graph --decorate A...B Example output: $ git log --cherry-mark --oneline --graph --decorate master...feature = 1e4f971 (HEAD, feature) Add some greetings = 926857a Add some greetings = bfede5b Add some greetings = 14099b6 (master) Add some Hellos = a0576fa Add some Hellos = 8822553 Add some Hellos In the above output, you will see that the first 3 commits in the output for feature are equivalent to the first 3 commits in the output for master, though the sha IDs and commit messages are different. From the official Linux Kernel Git documentation for git log: --cherry-mark Lik

Categories : GIT

Add UISearchBar programmatically to a programmatically added UITableView in a normal ViewController
Is your object implementing the delegate methods in UISearchDisplayDelegate? In other words, you have to define what happens when text is entered in the search bar, it does not happen automatically for you.

Categories : Objective C

Connected branches in Git
That's exactly what you should expect from a merge. If you wanted to rebase and fast-forward, you could have done that instead and had a straight line. Example: Before the merge, you had this situation: That is, the history of master and branch diverged. They share h as a common ancenstor. When merging (via git merge branch while on `master), you end up with a commit with two parents to unify that history: If that's not what you wanted, you can undo that and get what you wanted by doing something like: git reset --hard HEAD@{1} # or whatever commit matches 'j' to undo the merge git checkout branch git rebase master # incorporate 'i' and 'j' commits into 'branch' git checkout master git merge branch # this merge will be a fast-forward now Which will give yo

Categories : GIT

Git - different submodules in two different branches
You have more complete instructions on how to delete a submodule in this answer: The point which trips most of the users trying to remove a submodule is: git rm --cached path_to_submodule (no trailing slash) That is because they generally deleted (simple OS rm command, not a git rm command) the path to the submodule, which means it is no longer visible. And yet, it is still recorded in the index. If you need to remove the submodule in one branch only (and keep it in the other), then you need to: not modify .git/config: this is a local config used by the all repos (and all its branches): so no git submodule deinit here (that only cleans what is in .git regarding submodule). remove the submodule entry in: .gitmodules file (you can have different content of that file in different br

Categories : GIT

Shortcoming of git log? Why can't I see all the branches?
In order to see the same as in gitk, you would need at least a: git log --branches A more complete equivalent would be a: git log --oneline --graph --decorate --all I use a more complex alias in "How to display the tag name and branch name using git log --graph".

Categories : GIT

git showing old remote branches
Executing git branch -r returns no result So there isn't any remote tracking branch fetched from any upstream remote repo. But that has no bearing on the number of remote repo declared for your local repo: you could have 100 remotes repos declared, as long as no git fetch is done, a git branch -r would still return nothing. and when executing git remote rm origin again, I get Could not remove config section 'remote.origin' That is the standard message for saying that the remote you are trying to (again) delete doesn't exist. The first git remote rm origin did work. At this point, all what remains would be a remote named 'origin ' (with a space at the end). Or, as Peter Lundgren and Philip Oakley mention in the comments, an empty extra entry in the .git/config file, named "ori

Categories : GIT

Git: what exactly causes remote branches to update?
Like the book says, they're moved automatically whenever git does any network operations. So that would include git fetch, git push, and git pull. If the statement of Pro Git was correct I would expect my remote branch to be the same as my local one, since every fetch or pull would be a communication with origin. I think you're a bit confused about what is meant by "moved automatically". When remote branches are moved, they are moved to reflect the current state of the remote repository. The remote repository itself isn't changed by git fetch or git pull, so the remote branches don't move either. Try running git log --oneline --graph --decorate to see a nice graph of the current state of your repository. Note the position of branch-x and origin/branch-x in that graph. Then, run git

Categories : GIT

Rebase all branches without switching to them
Now, I want this to NOT affect my current state so that I can not be worried about the state of my git repo when I go home for the day. Then do it on a local clone of your current local repo. If it goes well (and Greg points out that it might not), then fetch the updated branches in your local repo from your local rebased clone, and pull/update your current branch on your own term, without having to worry about an automatic process having wreck everything in your working tree.

Categories : GIT

Why has Git allowed me to create two branches with the same name?
Git places very little restriction on branch names and e.g. slashes in branch names are perfectly fine. Also deleting a branch on the remote is done with e.g. $ git push origin :abc while deleting a local branch is e.g. $ git branch -d remotes/origin/abc where there is no ambiguity because these two entities live in different namespaces.

Categories : GIT

How do I get IntelliJ to see my remote git branches
In case anyone runs in to something similar I found that on my IntelliJ at least I had to run a fetch and then I could see the remote branches. It didn't appear that a pull was sufficient even though pull is supposed to fetch.

Categories : GIT

How can I stop git from moving my changes between branches?
The simplest thing to do would be to commit your changes to the private_dev branch, before checking out master. I would rather that the changes are not taken around with branch checkouts. Or even having two repos: one you never push (and in which you can commit in the private_dev branch) one in which you are pulling only the master branch (from the first local private repo), and then pushing to any remote you want. That way, you never push by mistake your private_dev branch.

Categories : GIT

Synchronizing a folder between two branches
You can checkout a particular file or folder from a specific branch or commit like this //current branch: gh-pages git checkout master yourfolder/ This checks out the particular folder you want to sync from the master branch to your gh-pages. Now, you can commit with only the changes in that particular folder.

Categories : GIT

Merge two branches using tortoise SVN
I would create a new branch from trunk and than merge your branch in the new branch via Merge a range of revisions. Because the new branch is newer all should work fine.

Categories : Svn

Move file in Git with branches
You will want to use the git mv in master branch to move things around. When you are ready to apply these things to your branches, you will need to have added and committed your changes. Then on each branch you will need to check out, and then I would probably do a git rebase master This will apply your changes on top of the folder structure. Of course, any code that you have that relies on the current structure will need to be changed. Some of the commands may look like this: git mv AndroidManifest.xml android mkdir android/AndroidApplicationTest touch android/AndroidApplicationTest/.gitkeep git add . git mv ServerPart server git status git add . git commit -m'Restructured application' git checkout dev git rebase master First, rewinding head to replay your work on top of

Categories : GIT

Remove old remote branches from Git
Push nothing to a branch to delete it: git push remote :remote_branch It's somewhere in the docs but it isn't really obvious. Or did I misunderstand your question?

Categories : GIT

Using Gitlab's API, how can I switch between branches?
Switch between branches? On the GitLab server side (which is what the Gitlab API refers to), you don't switch branches, since GitLab is managing bare repos (repos without a working tree, with any branch checked out). You might mean: "How to change the default branch" (the one checked out by default when a user clone a remote repo managed by GitLab). That is possible with gitolite (see "git change default branch (gitolite)"). However, it isn't with GitLab: the relevant API would be "Projects", but the "branch" section doesn't include anything to change the symbolic ref of HEAD of a bare repo managed by GitLab. That means you have to go on the server itself, within the bare repo, in order to execute a: git-symbolic-ref HEAD refs/head/development onionjake mentions in the commen

Categories : GIT

Printing Unpushed Branches
git branch -vv This will list all your local branches along with their remotes letting you know what their status is (if they are ahead, behind or both). To be sure that you are up-to-date for all the branches make sure to do git fetch If you only want to see the branches that are ahead you can do: git branch -vv | grep ahead

Categories : GIT

A Fix for Badly Merged Branches
Here's what Linus Torvalds has to say. You either need to rebase the branch to after the revert or revert the revert and merge.

Categories : GIT

merging two subversion branches
These procedures are not conflicted: in first sample default target "." just omitted in order to merge branch1 TO branch2 You have to: Read and understand SVN Book (link provided by Sameer) Use correct way of merging svn co URL/TO/branch2 cd branch2 svn merge -r xx:yy URL/TO/branch1 And, BTW, cherry-pick merging isn't best merging in the world

Categories : Svn

Git add a folder to all branches in a repository
There's no simple way to do this. The only way to achieve it would be to add the folder individually to each of the 10 branches, or add it to one folder and merge that commit individually into each of the other branches.

Categories : GIT

How can I tell what GIT branches are not fully merged?
Whatever you want to do in your local environment is not overkill. If you want to have 100 local branches, that's totally up to you, and if that turns out to be overkill (probably), then you can scale back appropriately. The "problems with fast-forwarding" are a matter of taste. The default behavior of Git is to fast-forward instead of merge if the two branches have not diverged. Like the author, I also don't like this, but I would not call it a "problem". As a workaround, I perform merges like this: # merge branch without fast forward and commit git merge --no-ff --no-commit branchname # code review git diff # commit the merge git commit -m 'merged: branchname' I use the alias rev = merge --no-ff --no-commit to simplify the merge step to git rev branchname (named "rev" as in "review

Categories : GIT

Import all branches of one Git repository into another one
Importing a branch is possible. Manage it once imported can be trickier. Importing: cd current git remote add old /url/to/git/old git fetch old git branch --track old_master old/master git branch --track old_feature-abc-backport old/feature-abc-backport git branch --track old_feature-xyz old/feature-xyz Managing: The question is: are the commits of the git 'old' repos the same as the ones in the git 'current' repo? If yes, then you can merge an old_xxx branch in a current branch, since the delta would be limited. Actually, I would like to do the import mainly for archival purposes, at least in the first step. When a branch goes out of maintenance Then a simple fetch is enough: All the branches from old will be immediately references as old/abranch: no need to create a local

Categories : GIT

How does one divide changes among multiple branches in git?
The problem with git stash and multiple branches is that once it is popped you have to stash again for the next branch. To get around this it is easy enough to just use a temporary branch. git checkout -b temp_branch git commit -a -m 'Changes that will go to several branches.' git checkout W git cherry-pick -n temp_branch (fixup all files here here) git commit -a -m 'Changes for W.' git checkout X git cherry-pick -n temp_branch (fixup all files here here) git commit -a -m 'Changes for X.' git checkout Y git cherry-pick -n temp_branch (fixup all files here here) git commit -a -m 'Changes for Y.' git checkout Z git cherry-pick -n temp_branch (fixup all files here here) git commit -a -m 'Changes for Z.' git branch -D temp_branch

Categories : GIT

Git branches on a solo project
Branches can be really useful, even on a solo project. They allow you to develop new features in isolation (if need be) while easily allowing you to throw out work, and/or keep it separated from mainline development (so you can start new features from a clean, stable portion of your codebase). (You can also prevent fast-forward merges by passing the --no-ff flag to git merge.)

Categories : GIT

tfs2010 same label different branches
In case it helps anyone. According to http://msdn.microsoft.com/en-us/library/ms181439(v=vs.80).aspx (the vs2010 one does not mention this but it still applies): Labels created within the graphical user interface are scoped to the root folder of the team project within which they are created. Labels created from the command line are scoped to the longest common path shared by the items specified in the label command. Not sure why MS have chosen to do this, as you can right-click a branch / folder and select "Apply Label" which is kind of misleading.

Categories : Visual Studio 2010

(Mis)understanding Git branches and checkout
Sounds like you didn't do "git add" to the new files before you did your commit on branch v6. They're still untracked, and git will just leave them lying around as you switch branches.

Categories : GIT

GIT CSS Multiple branches, so many conflicts
The only way I figured out how to do it is Create a new feature 1) Checkout ONLY the SASS folder from the last edited branch (e.g. git checkout feature/sass-01 path/to/sass) - This will only pull in the SASS so you will not have any of the template files you changed Have sass --watch sass:css running and it compile the CSS for you ready to start working on right away. 2) Add/Edit the SASS files and template files to fix the ticket When you are ready to deploy multiple features for testing 1) Go back into their feature branches 2) Checkout SASS folder from the VERY LAST feature you worked on. Have have sass --watch sass:css running. 3) Git Commit and Git Push the SASS / CSS files.

Categories : GIT

Continuous integration using git branches
I think you are looking for --dry-run switch: -n, --dry-run Do everything except actually send the updates. git push --dry-run ...

Categories : GIT

Different files for different branches only locally
One way of doing this is to put your db_config.php in .gitignore and create an file called db_config.php.example. Then when you deploy or send to your customer he/she would only need to copy the example to db_config.php file and insert correct credentials. We often use similar behavior in our company where every developer has his own database settings.

Categories : GIT

Merge two branches together with production at the top
With the example you provide, it looks like production is the name of the remote; git remote will list the remotes you have configured for that repository, and git remote show production will show details about the remote named production. It seems like you have a local branch named master, which points to the same commit as testminify, so in other words it's already been merged in, at least locally. The master branch is (almost certainly) a local copy of the remote branch production/master. What you need to do now is push your local changes to the remote. Your log suggests you'd need to do git push production master (push the changes made to the local master branch up to the production remote). Edit: I had missed the part about the detached HEAD. In order to address this, you can

Categories : GIT

How to manage branches with Kiln using Git?
On the Kiln UI, when you create a branch, it is a "clone branch", not a Mercurial named branch. If you use named branches in Mercurial, they will be automatically translated to Git branches. However, when you commit to the Git branch it will not convert back to the same named branch in Mercurial. The Kiln Team had to figure out the best analogue for the Git-to-Mercurial translation of Git branches, and they decided that a Mercurial 'bookmark' works the best. So when you push to a Git branch it will update or create a corresponding Mercurial bookmark (mercurial.selenic.com/wiki/Bookmarks, http://mercurial.aragost.com/kick-start/en/bookmarks/) with the same Git branch name, and that bookmark will be on the 'default' branch in Mercurial. I'd check with the members of your team that use Merc

Categories : GIT

How do I deal with nested branches in git?
You should only rebase local branches before pushing them out to the world. Having a shared repo which is regularly being rebased is simply the wrong way to use Git. (Also, well aware of the dangers of rebasing already-published commits, so please forego repeating.) But it's the correct answer. Rebasing rewrites history. The set of commits on a rebased branch is effectively unrelated to the set of commits on your local branches that haven't seen the rebase. Rebasing is basically a shortcut for doing a bunch of related cherry-picks. Merging & branching are the way you should be sharing code with git. Rebasing is meant to clean up your local work before exposing it to the world.

Categories : GIT

git orphan branches with same commits
(Not judgin if orphan branch is the right solution here, just trying to answer the initial question which was about duplicating history. As nneonneo comments regular branches are probably fine) The problem is that if the SHA1 are the same between the two branches, the second branch will always be a simple pointer to a commit of the first branch. What could work is: create a clone on that clone, insert an empty commit as the first commit of your master branch. See "git: how to insert a commit as the first, shifting all the others?" back on your original repo, import that master branch as a new one (my favorite trick to create orphan branch, as I explain in "Backup then reset master branch with git?". That would looks like: cd /original/repo git fetch /path/to/clone master:dev And t

Categories : GIT

git rebase with branches (whole tree)
You can use a lesser-known feature called grafts to splice the histories together. $ echo `git rev-list [E] -1` `git rev-list master1 -1` > .git/info/grafts $ git filter-branch --tag-name-filter cat master2 [other branches] Or if there are multiple branches involved, and you don't want to have to list them all, you can do: $ git filter-branch --tag-name-filter cat `git show-ref --heads | awk '{print $2}'` (for more details, see answer 161928, or blog article or advanced instructions)

Categories : GIT

Do git tags apply to all branches?
Let's say you are in branch myBranch. And you create a tag called myTag -----A-----B-----C-----D-----H-------I-----> master ---E----F-----G-----> myBranch | myTag The tag will be only on the commit object of the myBranch branch. I've worked with CVS too, and it tags revisions too, not all branches (but in CVS branches are special tags). I don't think. If you checkout myTag, you will be in the commit G of the example. You can't create tags with the same name on differente branches. If you do it, you will move the tag. There's no difference for an annotated tag related to this. Note: when checking out tags, you end up with "deta

Categories : GIT

extra branches created by git svn clone
So where did the remotes/svn/294.2%20bugfixes, remotes/svn/295-3329021 and remotes/svn/296-unicode pop from ? From the SVN repo :-). Seriously, these branches existed under "Branches/Wrye Bash", but they were deleted later in SVN. If a branch is deleted in the SVN repository, git-svn will not delete the corresponding git branch (because otherwise the branch and all its [unmerged] commits would be lost in git). If these branches bother you, you'll have to delete them manually. See e.g.How can I make git-svn get rid of remote branches that don't exist anymore? EDIT : Another question : Should I create local branches for those ? Usually, you only create a local branch if you want to commit to it. So there's no need to create local branches in advance, you can do it once you w

Categories : GIT

Merging git branches when one has a revert that the other doesn't want
I think you can merge the minor branch and 'revert the revert', I mean git merge <minor branch> git revert <revert commit> also check this 'How to Revert Faulty Merge', it is not about your problem exactly but you can have some idea about the effect of 'revert a revert'.

Categories : GIT



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.