git-branch

How can I check whether two branches are “even”?

只谈情不闲聊 提交于 2019-12-03 15:44:50
问题 The GitHub web interface has a nice feature telling me whether a branch is even with the master branch. Is there a command-line equivalent of this feature? I work with multiple repositories and I'm looking for a quick way to see whether branches are even or require attention. Here are screenshot of the GitHub web interface, for those wondering about this feature: 回答1: To compare the files of a branch called branch located on GitHub against master on the same repository, you can use git diff :

Git add a worktree from existing remote branch

瘦欲@ 提交于 2019-12-03 15:18:22
问题 I'm new to Git. I search a lot but nothing found that exactly matches my case. I have a personal WinForms application and in my remote repo there are 3 branches (master and 2 long running branches): master #the common features are here like Core, DAL,... north #customized for A company (long-running) razavi #customized for B company (long-running) At my office PC, I add 2 worktree for those north and razavi branches: $ git worktree list C:/Source/nis a6fb6e1 [master] C:/Source/north ebc7670

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

只愿长相守 提交于 2019-12-03 12:38:41
问题 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

Merge changes from one repo to another with different tree structures

自古美人都是妖i 提交于 2019-12-03 11:22:48
I have two Git repos, foo/master and bar/master: In foo: code_root ->dirA ->dirB -> *some files* In bar: code_root -> *same files as above* Now someone has made changes to *some files* ... how do I get those changes merged into *same files as above* ? When I say "merged" I mean I need the history (commit messages, log hashes etc.) of the deltas to come over as well. You can split the changes out to the subtree level, and then merge with your other branch: # from your foo project git subtree split --prefix=dirA/dirB/ --branch=temp-branch [--onto=<onto-sub-note1>] [<commit-sub-note2>] onto sub

Git add a worktree from existing remote branch

主宰稳场 提交于 2019-12-03 10:18:49
I'm new to Git. I search a lot but nothing found that exactly matches my case. I have a personal WinForms application and in my remote repo there are 3 branches (master and 2 long running branches): master #the common features are here like Core, DAL,... north #customized for A company (long-running) razavi #customized for B company (long-running) At my office PC, I add 2 worktree for those north and razavi branches: $ git worktree list C:/Source/nis a6fb6e1 [master] C:/Source/north ebc7670 [north] C:/Source/razavi eed08a2 [razavi] Everything is OK so far, I decide to work on this project from

Git tag release version?

人盡茶涼 提交于 2019-12-03 10:05:49
问题 A pre-release version MAY be denoted by appending a dash and a series of dot separated identifiers immediately following the patch version. Examples: 1.0.0-alpha, 1.0.0-alpha.1, 1.0.0-0.3.7, 1.0.0-x.7.z.92. semver.org For the purpose of disambiguation, what would be a "proper" way to tag a release commit (commit from the master branch)? Some ideas v1.7.2-release v1.7.2-master v1.7.2-prod v1.7.2-official v1.7.2-stable github.com/antirez/redis/tags 回答1: You can choose a policy similar to Git

“src refspec does not match” and “failed to push some refs” errors on git push [duplicate]

旧城冷巷雨未停 提交于 2019-12-03 09:56:33
This question already has answers here : Error when “git push” to github (5 answers) Possible Duplicate: Error when “git push” to github I tried to push my new branch (let's just call it new_branch ) to remote rep. There is no such branch there yet, but git push origin new_branch:new_branch should create it. When I try to do it, this is what I get: error: src refspec new_branch does not match any. error: failed to push some refs to 'ssh://git@***' I dug through million of questions like this on SO, but none of them specified these two errors at once and they referred only to master branch (I

Forgot to branch in git, need to move changes from master [duplicate]

给你一囗甜甜゛ 提交于 2019-12-03 09:35:22
This question already has an answer here: Move existing, uncommitted work to a new branch in Git 8 answers I eagerly ducked into code mode and modified some files, but neglected to branch from master first. The mods aren't so extensive that I can't redo them, but what's a good way of taking my (so far, uncommitted) changes in master and migrating them to a new branch, leaving master untouched in the end? If not yet committed anywhere ( git status shows a bunch of stuff modified, it's OK if it's "git add"-ed too): $ git checkout -b newbranch Despite the name checkout this usage (with -b ) does

Git: move changes off of master branch

若如初见. 提交于 2019-12-03 09:27:38
Basic question but this happens to me all the time: Make changes in a working-branch Switch to master git merge working-branch git push cap deploy (to staging) make a new cup of tea then I come back and think of something else and start making some changes...while still on master. What's an easy way to either: prevent direct edits on master (warning perhaps) to move all edits over to working-branch and clear master so I can continue editing on working-branch to spin edits into an entirely new branch new-working-branch and then discard working-branch ? Took a risk and tried recommendation in

GIT: How to copy contents of one branch to other branch?

若如初见. 提交于 2019-12-03 09:06:35
问题 I have 'develop' and 'InitialPomChanges' branches. I want to copy all the contents of develop branch to InitialPomChanges branch. 回答1: Assuming you want to overwrite all the contents of InitialPomChanges with what is in develop (i.e. you want the contents of InitialPomChanges to exactly match develop), do the following: git checkout InitialPomChanges git checkout develop . #copies the contents of develop into the working directory git commit -am "Making InitialPomChanges match develop" This