git-branch

Remove/hide git branches without deleting commit histories

不羁岁月 提交于 2019-11-27 13:04:49
问题 Situation: I have a main repo with a main dev branch and lots of "experiment" branches sprouting off from it (e.g., exp1 and exp2 ). The purpose of these experiment branches is to serve as placeholders for experiments that generate numerical results. I record the branch name (and commit ID) of the experiment branches so I can return to the commits to see precisely the code and history behind the results. But, now, there are so many experiment branches that it's getting hard to see the main

How to show git log with branch name

不想你离开。 提交于 2019-11-27 12:58:11
问题 I try git log w/ --decorate and --source options. But still can not get the branch name of commit 2f3cb60 and d7e7776 , Why? #git log 2f3cb60 --graph --decorate --source --all --oneline ... * | | | 1920ad5 refs/heads/gpio support gpio lib | |/ / |/| | * | | 2f3cb60 2f3cb60 fix * | | d7e7776 2f3cb60 fix | |/ |/| * | aa4dcfb refs/remotes/origin/httpd support * | cfc839d refs/remotes/origin/httpd add folder How do I show git log with branch name? 回答1: $ git log --graph --decorate --oneline *

List all modified files in git merge commit - even the fast forwarded

给你一囗甜甜゛ 提交于 2019-11-27 11:53:28
问题 I'm thinking if there is a way that when I merge a branch into another branch that ALL changed files are listed in my commit message and not just the ones which were modified in both branches. This would give me a better overview of what was changed in the branch just by seeing the merge commit. Is there a way to do this? 回答1: I don't know how to do that in the commit message. But after the merge, this will give the names of all the files affected by the merge commit: git log -m --name-only

Does github keep deleted remote branches in history? If so, can those be restored?

匆匆过客 提交于 2019-11-27 11:46:07
I was wondering if there is a way to restore a remote deleted branch in github. History clearly keeps record of the branch and merges with other branches but I'm not sure if it's possible to restore a deleted branch. Thanks. Highway of Life Yes, it's possible to restore a deleted branch from git. Find your Commit ID: Search for a branch using git reflog If you had the branch in your local git repo within the last 30 days, you may be able to find it in the reflog using the following: git reflog Search for the branch name in the reflog and note the HEAD{x} point or the commit ID. Re-create the

Configure a local branch for push to specific branch

荒凉一梦 提交于 2019-11-27 11:43:09
问题 Sorry if this question has been asked already. Am cloning from a repo named "git_lab" which has a branch named "test" When cloning i use "-b myname_test" to create a local branch named "myname_test" and local clone is named "myname_git_lab" When i do "git pull" it automatically fetches and merges changes from "test" to "myname_test", but for git push, i need to specify the repo and branch name. $>git remote show git_lab Local branch configured for 'git pull': myname_test merges with remote

Git: How to list commits on this branch but not from merged branches

风格不统一 提交于 2019-11-27 11:24:37
Suppose your git commit history looks like this: A---B---C---D---E---F master \ / X---Y---Z topic Is it possible to have git list only the commits on master, A-F? In other words, if the commit was on a merged-in branch, I don't want it show. git log has option --first-parent , so you won't get topic history. When merged from master , the master commits are the first parents in merge. Git log allows to display only those commits with --first-parent, so you get the right stuff. There is another general way to go about this that doesn't rely on --first-parent which will be helpful in certain

git merge squash and recurring conflicts

假如想象 提交于 2019-11-27 11:15:21
问题 I have a git repository with master and alt branches. alt branch contains modified version of master code, and i am trying to merge changes from master to alt like this: git merge --squash master Merge results in conflict: Auto-merging myproject/foo/bar CONFLICT (content): Merge conflict in myproject/foo/bar Squash commit -- not updating HEAD Automatic merge failed; fix conflicts and then commit the result. After I resolve conflicts and commit changes everything seems fine, but when i run git

Git Merge and Fixing Mixed Spaces and Tabs with two Branches

时光怂恿深爱的人放手 提交于 2019-11-27 11:14:18
I've gone through some similar SOQ's and have not seen an adequate solution for this case. I've noticed that in many files there is a dirty mix of tabs and spaces used for indenting. The coding standard we follow uses 4 spaces for a tab currently. Although this should have been addressed when it happened, I need to consider it now and would like to fix the files I come across. The issue is that there are two teams using different branches of code and we will eventually have to merge those branches. What will happen if we change all the files of our branch to be the correct formatting and try

Merge multiple git repositories into one, keeping branches history

亡梦爱人 提交于 2019-11-27 10:21:23
问题 I have four separate projects. They have their own git repository. and the same name of branches for all projects. /project/ /project/projA/ /project/projA/.git/ /project/projB/ /project/projB/.git/ /project/projC/ /project/projC/.git/ /project/projD/ /project/projD/.git/ All git repositories have the same name of branches, and of course their own master branch. Question I would like to merge all projects into one like so: /Project/.git/ /project/projA/ /project/projB/ /project/projC/

Having a private branch of a public repo on GitHub?

混江龙づ霸主 提交于 2019-11-27 10:15:43
I have a public PHP project in a GitHub repo, which contains just one branch (master). I want to have a separate branch/fork that is private for me (I have paid for private GitHub repos). I would like to be able to merge changes from the private branch/fork to the public repo, and vice versa. With that in mind, here are my questions: Can I have a private branch on a public repo? Can I fork my own public repo into my own private branch/fork? If both of the above are possible, which is the best way forward? If neither, how should I proceed? Is it possible to have a private branch on a public