git-branch

Git: move files in history too

北战南征 提交于 2019-12-04 03:32:27
is it possible with Git's tools to move files into a new folder while modifying its full history, as if the files had been there from their first add? I came up on this after merging some repos together: I moved the files from several repos to distinct folders inside one "super" repo, however the merged history behaves very bad with git rebase and git svn tools as totally different files may collide at their old locations of course. So now this got the job done: git filter-branch --tree-filter '(ls -A; mkdir TheSubdir; echo TheSubdir) | xargs mv' Strange but nice: the .git dir stays where it

command to determine the upstream ref of the current HEAD?

可紊 提交于 2019-12-04 03:16:31
I'm looking for what I hope is the simple one line command to determine the the correct upstream ref for the currently checked out branch? Essentially something like git branch --remote HEAD which (if it worked) would convert the symbolic pattern HEAD to the current branch name, and then the option --remote then changes it to the ref of the remote-tracking branch. (But it doesn't do that!) If I have branch morehelp with a config of remote = origin merge = refs/heads/morehelp The simple command line would return refs/remotes/origin/morehelp which is it's upstream tracking branch (ideal for the

How to resolve ambiguity between branch name and commit hash in git?

故事扮演 提交于 2019-12-04 03:12:01
I have a branch named 0726b and I want to diff my current working copy with that branch. Apparently there is also a commit that has a hash starting with that very sequence, because I get $ git diff 0726b warning: refname '0726b' is ambiguous. How do I tell git that it should take the argument as a branch name? Try this: git diff refs/heads/0726b refs/heads/0726b specifies a branch named 0726b . The file ./git/refs/heads/0726b contains the commit hash that this branch points to. 来源: https://stackoverflow.com/questions/51534635/how-to-resolve-ambiguity-between-branch-name-and-commit-hash-in-git

How do I safely delete a remote git branch?

邮差的信 提交于 2019-12-03 23:20:54
To delete a local branch in git I use git branch -d , but how do I safely remove a remote branch? I would like to delete it only when the remote branch is merged to my current branch . eckes The answer is partly covered here: How can I know in git if a branch has been already merged into master? While that post copes with local branches, you could find remote branches that are merged or not using git branch -r --merged to detect all remote branches that are already merged into the current git branch -r --unmerged to do the opposite git branch -r --no-merged is correct for the new version of

git remove files from only one branch

匆匆过客 提交于 2019-12-03 22:35:15
when I delete files from one branch it deletes from all branches. what can I do? when deleting a file with git and persisting that project state ( git commit ) it will only be deleted in that commit and its children (speaking: in that branch). when merging that branch into another branch it might well be possible, that the file is going to be deleted (unless changed in the other branch). when deleting a file, not committing it and then switching branches, git will apply your current set of changes to the other branch, in your case deleting the file there too. committing the delete should avoid

GIT - how to merge branches?

♀尐吖头ヾ 提交于 2019-12-03 19:38:45
问题 We decided to use GIT in our company but now got a problem.. We have several branches with different features. Now what we need is to merge that branches and push it to Master. How shall we do that with autoreplace - we have branch-a, branch-b, branch-c - we need to get them all in Master but in case of repeated files the branch-b should be Major and branch-c - minor. Upd: branch-a: -file1 -file2 -file3 -file4 branch-b: -file1 -file5 -file6 branch-c: -file1 -file2 -file7 -file8 we need in

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

主宰稳场 提交于 2019-12-03 17:24:42
问题 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

Removing large file from git history?

寵の児 提交于 2019-12-03 16:38:59
We have a remote git repository where there are no size restrictions for files and we had pushed a 300MB into it. We then realized it and then removed the file from the repository. Meanwhile the same repository was added to github and when we try to push the changes to github, we get the large file size error. remote: error: File dir/filename is 312.27 MB; this exceeds GitHub's file size limit of 100 MB To fix this, I tried using the interactive git rebase solution suggested at How to remove/delete a large file from commit history in Git repository? , but at the end of the rebase operation I

Do git tags apply to all branches?

笑着哭i 提交于 2019-12-03 16:14:09
问题 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

How to forcefully delete a remote branch in GitHub?

走远了吗. 提交于 2019-12-03 16:06:27
问题 I have 2 remote branches : - pending-issues-in-project - new-issues-in-project I tried to delete pending-issues-in-project like this : git push origin :pending-issues-in-project , but i got the error : error: unable to push to unqualified destination: pending-issues-in-project The destination refspec neither matches an existing ref on the remote nor begins with refs/, and we are unable to guess a prefix based on the source ref. error: failed to push some refs to 'git@github.com:forkedRepo