git-branch

How do I create a master branch in a bare Git repository?

隐身守侯 提交于 2019-12-03 04:12:13
问题 (All done in poshgit on Windows 8): git init --bare test-repo.git cd test-repo.git (Folder is created with git-ish files and folders inside) git status fatal: This operation must be run in a work tree (Okay, so I can't use git status with a bare repo; makes sense I guess) git branch (Nothing, it seems the bare repo doesn't contain any branches. Do I have to add them from a cloned repo?) cd .. mkdir test-clone cd test-clone git clone ../test-repo.git (I get a warning about cloning an empty

git - confusion over terminology, “theirs” vs “mine”

梦想与她 提交于 2019-12-03 03:47:17
问题 I'm completely confused about what mine vs theirs means. In this specific case, I've got a feature branch where I just squashed about 80 commits via rebase -i and am merging this back into develop . I got a few conflicts, and I just want to use whatever code is on my feature branch. I tried "mine" but that actually seemed to do the opposite. Could someone shed some light on this terminology? 回答1: ours and theirs is a somewhat confusing concept; exacerbated when performing a rebase: When

Git - generate patch for all commits in a branch

倖福魔咒の 提交于 2019-12-03 03:27:53
问题 How can I generate patch for all commits in a given branch by knowing only the branch name? This step is part of a complex workflow all of which is being automated. Hence requiring someone to manually determine the first commit in the branch is not an option. Note that anything relying on reflog is not an option either because changes in the branch are not made locally. 回答1: If you know from which branch your "given branch" has been created, then making a patch is easy: git diff master

How to work simultaneously on several different versions of files with git?

二次信任 提交于 2019-12-03 03:03:23
I'm currently working on a my own neuroimaging toolbox that runs under MATLAB / SPM8 and most program files in my repository are MATLAB *.m files. I have different feature branches and one analysis branch, that I use for ongoing analyses using the current version. At the same time I am developing the code in master and feature branches, that are then constantly merged to master branch. Now the problem is that, the analyses I'm running in analysis branch do take a lot of time (even days), and during that time I'm not able to git checkout master or git checkout new-feature . This limits my

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

試著忘記壹切 提交于 2019-12-03 03:01:03
问题 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 then I lose on not having all the branches from the source/original. update: I ended up pushing all my branches into the enterprise git. if you just do a git push yourRemoteName myNewBranch then it will push the code into

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

Switching a branch after aborting current changes in git

南笙酒味 提交于 2019-12-03 02:36:51
问题 I cloned a git repo and then started playing around in its master branch. After a while, I want to ignore the changes I just made (without committing them), and switch to a different branch. However, it stops me from switching because there are uncommitted changes. How do I ignore them without stashing them either? This is what happens: $ git checkout gh-pages error: Your local changes to the following files would be overwritten by checkout: somefile.txt Please, commit your changes or stash

Move branch to another branch

我只是一个虾纸丫 提交于 2019-12-03 02:31:23
I have started doing some work on a branch which I have in term realised was the wrong branch. Is there a way to move a branch to a different branch. For example: A -- B -- C -- D -- HEAD \-- E -- F -- G -- H -- I -- J \-- K -- L And I want this: A -- B -- C -- D -- HEAD \ \-- K -- L \ \-- E -- F -- G -- H -- I -- J Let's say you've named your branches like so: A -- B -- C -- D (master) \-- E -- G -- H -- I -- J (current-parent) \-- K -- L (my-branch) What you want to do is rebase my-branch onto the B commit like so: git rebase current-parent my-branch --onto B You could use git rebase --onto

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

How to work simultaneously on a few branches

陌路散爱 提交于 2019-12-03 02:11:13
问题 This is a follow-up on this question on creating branches. It strikes me as odd that I would still work on one repository because the files on my local machine will be a weird mix of different experiments. I would imagine the best-practice method is to duplicate the repository and work in different folders on my computer for each branch -- but I don't know how to set this up. I have my current repository at Documents/San/CompProj so what are the commands I'd use to create a new repository