FAQ Database Discussion Community


How should I add new files when I already have multiple branches

git,branch,git-branch,branching-and-merging
We have recently started using GIT and it has worked out well, but we sometimes hits bumps that we don't know how to best solve. Right now we have multiple branches. master, develop and lots of feature branches (one or more per developer). Now we want to add a directory...

Can I delete old git branches [duplicate]

git,branch,git-branch,git-merge
This question already has an answer here: Should I delete a branch after merging it? 2 answers I've merged my code into the master branch and all is good now. Code is production ready. I want to cleanup some of the old branches as there's really no need for...

Git, non-fast-forward issue on master when working on a branch

git,git-branch,git-pull
I am working on an branch, let's say it's branch1.1. I make several changes and just use 'git commit' to commit those changes. Then as I usually working on master, I do an git push to check in them. However such errors occurs: To [email protected]:flt/test.git ! [rejected] master -> master...

git branch on another server

git,git-branch,git-remote
I am working with a customer who provided git branch access to get the latest src code. I've to continue working with that src code. But my company won't allow me to commit the src code directly to their branch. And so, my company provided with our own repository account...

How do you remove files from one and only one branch in git

git,git-branch
I want a branch to hold all the files from my master branch except for foo.txt and foo2.txt. How do I do this?

How to make a remote branch from a local branch in Git?

git,github,git-branch
I was working on a branch. But one of the contributors deleted the remote version of the branch. So, I now have a local copy of the code but no remote branch to push to. How do I recreate the remote version?

Advantages/disadvantages to branches and forks

git,github,git-branch,git-fork
I am currently working on a project via a fork of the main repo. I am committing my changes to <fork>/master and then submitting pull requests to <upstream>/master. I have write permission for <upstream>. Am I correct in thinking that I could make this simpler by deleting my fork and...

how to make a new branch in visual studio 2015?

git,visual-studio,branch,git-branch
i am using git on visual studio online in visual studio 2015 and am trying to figure out how to create a branch. this is the usual answer on the internet: https://msdn.microsoft.com/en-us/library/hh850437.aspx & https://msdn.microsoft.com/en-us/library/jj190809.aspx#create if you check the image is shows the branch and the drop down arrow where i...

Can not host a webpage on Github

github,git-branch
I have a javascript and html snake game and I want to host it on github I do All the steps and make a gh-pages But I get this error 404 File not found ?when I search Username.github.io/repository-name Any idea why and how I can fix it? Should I wait...

Being given zip archives with .git - how to integrate into own Git repository?

git,bitbucket,git-branch,branching-and-merging
I have purchased an iOS game template and received the source code as a zip-archive including .git subdirectory of the author developer: Then I have created my own BitBucket repository. How should I put the new files there and how to integrate the Git history of the files with the...

Git: How do I keep update with a specific branch?

git,git-branch
Question 1 What if I have not yet created any git repo locally, and I need to first time sync with a specific branch. Question 2 What if I my local folder is git is currently in sync with Master, and I want to completely sync with another branch ?...

Git: push to different locations per branch

git,github,git-branch
I'd like to set up a git repository in which I can push/pull my changes to/from different locations depending on which branch I am. The idea is to have two branches: master: for internal development (I'm disallowed to publish it at all) I would push/pull from local Stash dev: for...

Create private branch on remote repository in git

git,git-branch,remote-branch
I would like to build specific flow on our company git. developer create a branch on his local machine and commit there some files. dev push this branch to remote repo Other devs cannot access to this branch after few rounds off pushing dev decide to publish his changes. merge...

GitLab shows deleted branches

git,git-branch,gitlab
I have a problem with showing branches in GitLab. Between displayed branches there are two which were deleted. I believe it is because of their name origin/ondrat/xxxxx and origin/vladan/xxxxx. So the full path pathspec is origin/origin/ondtrat.... These two branches will not appear in the listing git branch -r and in...

Git branching and reset head of master

git,git-branch
Git Step -1: I made few un-commit changes to master branch at local machine. Step -2: Later i decided to create separate branch for those changes because i notice these changes are much bigger and has become a feature. Step -3: I created a branch switch to that branch made...

How to replay a commit onto a branch that already contains the commit?

git,git-branch,git-commit
Lets say our commit history looks like 1--2--3--4 ^ HEAD Where 4 is the most recent commit. Is there a way to replay the changes from commit 2 (the differences between 2 and 1) onto commit 4? You are probably wondering why anyone would want to do that. Lets say...

When using “git pull” operation, It will result in a new log which display “Merge remote branch into local branch”

git,git-branch
When using "git pull" operation, It will result in a new log which display "Merge remote branch into local branch". The log just look like as follow: SHA-1: 3c4e93220199713ac4ad4695b93ea1d4f7f821fc * Merge branch 'feature/hub' of http://tfs.bg.com:8080/tfs/DefaultCollection/_git/gitProject into feature/hub Can anyone tell me why? Any help will be appreciated!...

git push --tag keeps commits

git,git-branch,git-tag
When pushing to the master, I read that it is recommended to use: git tag -a <tag name> -m <message> ; git push --tags I added a new tag, and pushed the changes to the master, now I modified another file and want to push it to the master with...

Why should I create new branch in git repository? [duplicate]

git,branch,git-branch
This question already has an answer here: When should you branch? 15 answers If the master is default branch of git repository, why should we create another branch? What is the benefits of creating new branch?...

Git merge two remote branches in one repository

git,merge,git-branch,git-remote
I have one remote repository with many branches.For example My repo name is http://navis.com/MyRepo.git There has many branches, development production(master) testing I would like to merge development branch to production branch (master). Can anybody share git command for merging two remote branches?...

GIT: Why do I need to solve my merge conflicts twice when using rebase?

git,git-branch
I really like the git pull --rebase option, but when using it combined with a merge conflict I end up solving my conflicts twice. I have tried to use git pull --rebase=preserve which should make it considering merges as well. Try have a look at the following example: # do...

move the uncommited change to another branch

git,github,git-branch
I have made some changes in project, but I didn't commit the changes. They are in the state of Changes not staged for commit . Then I realised I should make these changes in a separate branch than the current one. How can I create a new branch which can...

“git remote show origin”: why all branches show “tracked” even when some aren't?

git,git-branch,git-remote,git-track
Why does "git remote show origin" list remote branches as "tracked" even when those branches are not linked to a local branch for pull/push? Does "tracked" mean something else in this context? I thought that was the whole meaning of "tracked": git docs on branch tracking. 1) clone a repo...

git branch -d throws error: branch not found

git,git-branch
When I type git branch i get * master localbranch but when I try to remove the branch, git branch -d localbranch i get a not found error: error: branch 'localbranch' not found., I also tried to force the delete with git branch -D localbranch but it's giving me the...

Move develop changes to a new feature branch

git,git-branch,git-merge,git-flow
For my project I use git-flow. I have master and develop branch synchronized with remote-repo Usually for all changes I create a feature branch, edit the files, commit the changes on the feature branch and close the branch with a merge in develop. But sometimes I forget to create a...

How can I retrieve git remote branches?

git,version-control,git-branch,git-remote,git-checkout
I'm clearly missing something since I am unable to fetch the remote branch I need on the server from the git repo I've been working with locally. On my local dev environment I run git remote -v and it gives me: origin [email protected]:the_repo (fetch) origin [email protected]:the_repo (push) I run git...

updated local but unable to push

git,git-branch,git-push
i am unable to push but my local is already updated git pull origin develop already up-to-date while pushing git push origin develop ! [rejected] develop -> develop (non-fast-forward) error: failed to push some refs to 'xxxxxxx' hint: Updates were rejected because a pushed branch tip is behind its remote...

Having git pull and push to different default remotes based on the branch

git,github,git-branch,git-push,git-remote
Im trying to figure out how to setup git where I can pull/push from/to one remote and it by default pulls/pushes it into its own local branch. This remote won't be the origin remote and Id like to merge the branch occasionally to the master branch which will be pushed/pulled...

How to create an empty branch for documentation

git,git-branch
We have several Linux servers in the office. I would like to keep some record of changes in settings. Therefore I thought it would be a good idea to put all configuration files in GIT. The setup I would like to have is as follows: bare repository --> configuration.git with...

Tools for Apache Cordova - Installed Plugins are skipped in build

cordova,github,git-branch,visual-studio-2015,visual-studio-cordova
i have a cordova app with 6 plugins and the strange behavior that app is not working after i create a new clone of the sources from github. If i install a plugin over the config.xml dialog and build the android version of the app. The native source file (*.java)...

Download a bitbucket git repository via api

git,repository,bitbucket,git-branch,bitbucket-api
I am trying to make a script which get the repository from bitbucket and upload it to my ftp server. My first problem is that i dont know how to get the repository.. Is there a way to download it with the official Bitbucket API? Or should i make a...

How is a branch different from a folder, in a GitHub repository?

git,github,git-branch
I'm new to GitHub, and I don't exactly understand what a branch is. I got a feeling it is like a folder. Please explain: what exactly is the difference between folder and a branch?

Join old and new repo, created by copying files (not cloning), preserving commit history

git,git-branch,git-remote
To simplify things I have the following structure in git old_repo for "subpath": subpath/old_commit_1 subpath/old_commit_2 subpath/old_commit_latest I decided to move to a new_repo and just copied the latest version of "subpath" (from old_commit_latest) into it without any commit history. So the new_repo now has "subpath" and a bunch of new...

Is it safe to delete the original repository after splitting it?

git,tfs,git-branch
When our sources were migrated from TFS to git all projects were placed in a single repository. Later we learned this was not the recommended way so we decided to migrate each project into its own repository. Because we did not want to lose our history (again) we used the...

Git Move older commit(s) to new branch so I can merge them back later

git,repository,git-branch,git-merge
Yet Another Git Move Commit Question. I have a master branch that all work is being committed to. A client decided feature 123 is no longer wanted in a release (to be released later). I need to pull out commit B (for a lack of my complete understanding of Git...

Deleted branch unexpectedly git in visual studio

git,visual-studio,github,git-branch
I am working in visual studio 2013 with git and today unexpectedly i deleted a branch . Now when i go to create branch it doesn't show in drop-down to select and create that again .

Unable to find branch in git repo

git-branch,git-commit
In the current directory. I had made a repository yesterday from this directory. now: git branch foo After doing some changes in the file.. git add . git commit -m "commit1" git push. I am unable to see the branch from my repo on github. While git branch does show...

How to go back to a previous commit and make change in this previous commit?

git,git-branch
I am working with git. I had a branch from a master since some days. $ git log commit 412455451515dd5d5dldldld454585fgdgjd // #7 Author: me Date: Fri Mar 03 14:27:55 2015 +0100 feature7A commit 95299628812ae425c06accc61a0ef4203cc // #6 Author: me Date: Wed Mar 03 11:20:35 2015 +0100 feature6A commit 82f1691fcfd6348ddf5462be42bf9983b2f // #5...

Patch does not have a valid e-mail address after `git am`

git,git-branch
After: git am --signoff < /tmp/diff_api_public.patch Output was: Patch does not have a valid e-mail address. And now, I have the repository in the state: project-folder[branch-name|AM 1/1]$ What's next to regain the branch correct?...

Multiple streams over single project in Git?

git,version-control,stream,git-branch
I went through blog regarding GIT best practices model. As we are going to make GIT as our major head for SCM for the upcoming projects in our organization, I have some doubts, regarding them not able to find much over internet. Our project architecture is: We have only one...

Setting where a local git branch pulls AND pushes

git,git-branch,git-push,git-pull
I am working on my forked repo with 2 main branches: master: pulls from main_project/master bootstrap: pulls from collaborator/bootstrap The second remote is a fork also contributing to the main project I want the above branches to pull from the respective related repos; however, I want them to push to...

How to import bugfix of master in all other branches without including the commits before?

git,version-control,merge,git-branch
I have some branches: branch 1 and branch 2. They have their origin from the master branch. Now there were some changes in the master branch. One is a critical bugfix, which has to be imported on branch 1 and 2. But there is a change (or perhaps multiple) which...

View previous branches in git

git,git-branch
I'd like to list the last 5 branches I've been working on in time order. I'd assume it's something like: git branch -l <some time-related flag here> But looking through the docs I don't see anything time-related. Has anyone done this and, if so, how? ...

GitLab: is there a way to assign a status/comment to a branch?

git,version-control,git-branch,gitlab
I'm planning to use GitLab to manage Git repositories (mainly Linux kernels from various hardware vendors). Currently, I'm using Gitolite to manage users on Git server and MediaWiki to have what a call a "branch table"; in other words, a table where the single users report: branch name (e.g. xboard-feat-i2c2)...

I've tried to change a branch but I aborted before it ended, now I have a lot of unstaged files

git,git-branch
After the many unstaged files I've done git stash save --keep-index and now I have a lot of empty folders from the other branch. Now everything is messed up. How to undo and only have the correct folders from my branch?...

I removed remote branch in GIT but other clients still see this branch

git,git-branch
In GIT I removed remote branch: git push origin :my_removed_branch But if other client will do this: git branch -a He will see the removed branch. ... remotes/origin/master remotes/origin/my_removed_branch How do I get other customers stopped to see the removed branch? Git version: 1.9.5...

Git merge/cherry-pick all commits of a branch

git,merge,tags,git-branch,git-cherry-pick
Scenario: master | \ dev | \ feature1 | | | / | / tagV1 | \ feature2 | | / | / tagV2 | \ fixForV1 | | / | / tagV1_1 Description: Create repo Create and checkout branch dev Create and checkout branch feature1 .. implement the feature...

Cannot unstage branch

git,git-branch,git-repo
I am very confused at the moment about my branch's staging. I am on a branch called lazy-load Git status shows: nothing to commit, working directory clean git diff and git diff --cached show nothing. But if I push to origin lazy-load, a large number of files are pushed, almost...

New branch creation in Git using old commits in existing branch

git,git-branch
I have a stable point commit/tag b1. Now I want to create another branch, say b2, from that stable commit/tag, and work on it. I am thinking I should do this: $ git checkout b1. $ git fetch --tags $ git checkout tags/my_stable_tag Now create and move this code to...

In git, are there any issues with naming a branch after a commit id?

git,git-branch
I run into a detached head state often. I would like to create a script that, when I run, automatically creates a branch where I am at and names it after the current commit id. It appears that git will let me do it, but could a branch and commit...

Is there a way to get a visual diff on two branches in SourceTree?

git,git-branch,atlassian-sourcetree
Does Sourcetree offer a way to visualize differences between git branches? I'm looking for: names of files that have changed diffs between these files ...

Is it possible to fork a public GitHub repo into an enterprise repository?

git,github,git-branch,git-repo
There exist a public repo for Quick framework here. I'd like to be able to fork this into a private enterprise github repository. Forking would allow all the branches to remain. the alternative would be to clone the repo and push up only a single branch to the enterprise but...

In Git, how can I list all files that exist in branch A that do not exist in branch B

git,git-branch,git-diff,git-diff-tree
Is there a Git command I can use that will list the names of all files that exist in one branch that do not exist in another branch? Background: Someone deleted some history and then pushed origin/master. Some team members have been saying they are missing some files. I think...

Prevent developers from creating new git remote branches

git,git-branch
In a centralized workflow, is there any way (with local or server configuration) to prevent developers from creating new remote branches in git? We are happy creating local branches but sometimes this local spikes or test-feature branches are going to remote by mistake. Any way to avoid this without going...

How to pull remote Git master if it doesn't exist locally?

git,git-branch
I created a Git "newfeature" branch on my laptop, implemented a new feature, and then merged newfeature into my master branch. As I was working on the new feature, I had also created and pulled this newfeature branch on my production server in order to test it there. Now that...

Does BitBucket allow fork to be created from existing forks?

git,github,bitbucket,git-branch
I have a repository. From this main repo, I have created 3 forks for X, Y and Z websites. Now, I want to keep the Z fork as the base for another website. In this regard, I think I need to create a fork of the Z repo fork and...

How to rename a remote git branch name

git,repository,rename,git-branch
I have 4 braches like master -> origin/regacy, FeatureA -> origin/FeatureA. As you can see above, I typed a wrong name. So I want to rename a remote branch name ( origin/regacy => origin/legacy or origin/master) I try to command below. git remote rename regacy legacy But git console retured...

Better to use Tag or Branch?

git,git-branch,git-tag
I have several git repositories. For every project I need a few of them (tags or branches). After the project is finished I create a branch from the last commit. Because the next Project there could be radical changes, so they may not be compatible to each other any more....

How to fetch all branches - including the remotes remote branches?

git,git-branch,git-clone,git-fetch
There are several upvoted questions here "how to fetch all the remote branches", and the short (upvoted) answer seems to be that git clone and git fetch should do this by default, and that one can see the remote branches by running git branch -r. However, I'm still a bit...

git: Best way to determine unmerged branches in a script

git,merge,git-branch,git-plumbing
At an interactive prompt, I can use the git branch -r --no-merged command to determine remote branches that haven't been merged yet. However, git branch is a porcelain command and therefore is not suitable for use in a script. Is there any good plumbing command I can use to determine...

Rebase instead of fast forward

git,git-branch,git-rebase
I'm new to GIT and I can't figure out if my question already has an answer. Please read it carefully before marking it as duplicate. I have a branch, let's call it public, which is pushed and in sync with origin. At one point, I create another branch, private, which...

git push origin master error: The following untracked working tree files would be overwritten by merge: .DS_Store

git,bitbucket,git-branch,git-push,git-pull
It's been a while that I am facing the following problem. What's the fix to it? I am just a newbie in git so please be instructive. I have already tried to follow the commands shown in the error but wasn't successful. Monas-MacBook-Pro:demo mona$ git branch * master Monas-MacBook-Pro:demo mona$...

Reset a git branch globally (for all users)

git,github,git-branch,remote-branch
In our current workflow, we have 2 main git branches: master - stable release branch testing - were everyone tests their code Now every developer creates new branches for each feature they develop. When they are done, they merge it to testing, and when our QA says it's good to...

Git: how to commit and cherry-pick bug fix? [closed]

git,version-control,git-branch
Our development team uses a dev branch for majority of commits and branch out each month for release branches. I was wondering what's the most popular model to handle bug fix commits. Commit to HEAD of monthly branch (most recent one, say 2015.Jun branch) and cherry-pick (or just rebase) to...

How can I list all branches that contain commits newer than a specific date?

git,git-branch,git-log
When using git log, I can supply --since=<date> to limit the log to commits newer than a certain date. With git branch -r, I get all the remote branches. How would I get the list of branches that have contributions that are younger than a given date, i.e. all branches...

Switching branches in Git with external dependencies

git,maven,dependencies,git-branch
Has anyone had to deal with the issues of switching git branches in a project that has Maven (or any other external) dependencies? For example, suppose that in one branch I have a maven dependency, and in another I don't (or have a different version required). Would I have to...

Tracking changes using git during code review (stash vs. branch)

git,git-branch,git-stash
In the interest of keeping code reviews small and concise, I've submitted a smaller code review than a full feature. It is the cleanup before a larger change, but to avoid cluttering up the final review with the cleanup, I've made this review. My later work will build on this...

git pull command output message meaning into which branch

git,git-branch,git-pull,git-remote
Say there is a remote branch br1 checkout on the remote repo, and the master branch on a local repo. Command 1: If I do a "git pull origin br1:br1" it pulls remote br1 into local br1, and shows: 9188a5d..97d4825 br1 -> br1 9188a5d..97d4825 br1 -> origin/br1 command 2: If...

Branch a public git repository, on a private git server

git,git-branch
I have my own git server on a local Fedora machine. I have two development machines, a local Fedora machine, and a local Windows 7 machine. (Both development machines and the git server are all on a local network, so I'll get faster speeds this way than using github.) There...