git-branch

Broken branch in git, fatal: your current branch appears to be broken

半腔热情 提交于 2019-12-03 06:38:16
问题 Here is my case: I was working on one branch. Pushed new commits to the remote. Switched back to the master branch. But suddenly after typing git checkout master command my computer encountered blue screen of death and an unexpected force shut down happened. After starting back my computer I have checked the status of my current branch and as a result I got each and every file as marked new files. Now, I am stuck at this point and after git log command I am getting error $ git log fatal: your

git remote prune origin does not delete the local branch even if its upstream remote branch is deleted

╄→гoц情女王★ 提交于 2019-12-03 05:49:14
This is a common use-case for me, I clone a repository, checkout a branch, do some code changes, make multiple commits, then when its stable, i do a push to remote, eventually the branch gets merged and deleted. and I'm left with a local branch with upstream gone. I was looking for a safe way of deleting all such branches. from the description, it seemed like git remote prune origin is doing this exactly. But it doesn't seem to be working for me. Seeing the following behaviour, the branch encrdb_init has been deleted from remote but the git remote prune origin command does not seem to prune it

What happens in the child branch if I delete a parent branch in git

拈花ヽ惹草 提交于 2019-12-03 05:44:45
I am planning to rename a branch in my git repository. I found out that the easy way to do that is to make a new branch from that branch and give it the desired name. After that I want to delete the old branch (the parent). But I'm afraid that I will lose data in my new branch if I do that. What happens with the commits originally made to the parent branch if I delete that branch? VonC What happens? nothing. If you create a branch where another is, you can "delete" that other branch without losing anything. A branch (HEAD) is just a pointer to a commit. As long as those commits are referenced

Do git tags apply to all branches?

笑着哭i 提交于 2019-12-03 05:26:44
I'm getting my feet wet with git tagging, but my previous background is in Subversion, where "tags" were really just copies, not "real" tags... If I add a tag to a git repo, is it applied to all branches or only the current one? For example, if I currently have these branches ( git branch -v ): * master deadbeef My master head comment dev baddfeed My def head comment And the currently checked out branch is master, as you can see. Now suppose I git tag -a TAGNAME , does TAGNAME apply only to deadbeef (master branch) or to baddfeed (dev branch) as well? e.g., Say I subsequently switch to the dev

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

跟風遠走 提交于 2019-12-03 05:10:01
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: To compare the files of a branch called branch located on GitHub against master on the same repository, you can use git diff : git diff origin/branch origin/master The following will work to compare the commits between the two

Sharing files across branches in Git

筅森魡賤 提交于 2019-12-03 05:08:40
There are a bunch of files in my project that are sometimes modified but always shared among many different branches. Examples include build scripts, batch files that include paths, etc. Even the .gitignore file itself is an example. I want this stuff in source control, but I don't want individual branches to keep track of changes to them. How do you handle this situation? Do you track everything related to your project in Git? What's your approach to shared objects? Is .gitignore my only option? Keep your build scripts and batch files in a separate repo? Instead of relying on submodules, have

Git: merge only the changes made on the branch

元气小坏坏 提交于 2019-12-03 04:53:02
G---H // Release Branch / / A---B---E---F--- // master \ \ C---D--- // bug fix branch Based on our particular needs for our project, it is quite common for the above scenario to occur. We have our master/dev branch with some commits. Then we get a bug report and start fixing that on the bug branch (commits C and D above). More commits happen in the dev branch in the meantime. Next we are told we need to create a release for a customer which cannot include the changes introduced by commits B, E and F above, but it should include the bug fix. So we branch off of dev before change B was ever

List merge commits affecting a file

末鹿安然 提交于 2019-12-03 04:52:19
问题 I want to find all the merge commits which affect or involve a given file. For background, someone mis-resolved a conflict when merging, and it wasn't noticed by the team for a few days. At that point, a lot of other unrelated merges had been committed (some of us have been preferring to not use rebase, or things would be simpler). I need to locate the "bad" merge commit, so it can be checked to identify what else might have been reverted (and, of course, to identify and punish the guilty).

How to push a single file in a subdirectory to Github (not master)

爱⌒轻易说出口 提交于 2019-12-03 04:48:24
问题 I have changed a single file in a subdirectory of my repository and I want to push just that file to Github. I've made a small change to one file, and I don't want to re-upload the entire repository. It seems like all of the instructions that I've seen so far require me to merge locally with the master and then push my local master to the remote origin. How can I push just that one file? 回答1: When you do a push, git only takes the changes that you have committed. Remember when you do a git

How to tell Git to always pull the master branch?

三世轮回 提交于 2019-12-03 04:17:42
问题 I find git docs very cryptic regarding this issue. I want to do a simple thing, but it seems doing it is not simple at all. I have the following situation: $ git remote -v origin git://192.168.0.49/mnt/repos stick /mnt/titanium/podaci/repos I can use git pull to fetch and merge from origin, and that works fine: $ git pull Already up-to-date. I can pull from stick like this: $ git pull stick master Already up-to-date. However, when I pull from stick without the master part, I get this message: