git-branch

How can i copy a file from local commit on a different branch?

旧巷老猫 提交于 2021-02-05 06:51:28
问题 I committed a file on master branch but not pushed remote . Now i am working on feature branch and i want that file to be copied to feature branch from master branch. How can i do this? 回答1: You can checkout a specific file from another branch: git checkout master -- path/to/file The file will be copied from the branch as is into the working tree, and automatically staged. Note that the relative path from the working tree root is important. For example if you are in the root of the working

number with special character next to git branch name in terminal (or iterm2)

六眼飞鱼酱① 提交于 2021-01-29 17:27:17
问题 I'm a Mac user and use Iterm2 with zsh When I open my git directory next to my branch name, there is a special character with a number for example (my terminal) ~/projects/myProject | on git mybranch *1 ~/projects/myProject | on git mybranch !1 (As far as I guess, !1 is that a file in my directory is modified.) I want to know what is the meaning of * and ! and also what number means. and where can I find information on this special character? my prompt : ${$((_p9k_on_expand()))+}${(e)_p9k_t[7

How clean up merged git branches can delete pull requests?

∥☆過路亽.° 提交于 2021-01-29 10:26:17
问题 I was about to follow the instructions to delete all branches on remote that are already merged: git branch -r --merged | grep -v master | sed 's/origin\//:/' | xargs -n 1 git push origin from How can I delete all Git branches which have been merged? But noticed WARNING: This command will delete and close open pull requests. – Diego Aug 14 '17 at 15:19 As I understand , git branch -r --merged will return only branches, not pull requests. Is a warning about the scenario when source or target

How to remove remote branch only from my local git? [duplicate]

十年热恋 提交于 2021-01-29 06:56:00
问题 This question already has answers here : Cleaning up old remote git branches (9 answers) How do I delete a Git branch locally and remotely? (39 answers) Closed 6 months ago . I know the command git push -d <remote> <branch_name> I want to delete remote branch only from my local git env . The command above removes remote branch from my local and remote github also. However, if I had removed remote branch in github directly like this, there is no branch named feature/search in remote anymore,

How to remove remote branch only from my local git? [duplicate]

不羁的心 提交于 2021-01-29 06:53:53
问题 This question already has answers here : Cleaning up old remote git branches (9 answers) How do I delete a Git branch locally and remotely? (39 answers) Closed 6 months ago . I know the command git push -d <remote> <branch_name> I want to delete remote branch only from my local git env . The command above removes remote branch from my local and remote github also. However, if I had removed remote branch in github directly like this, there is no branch named feature/search in remote anymore,

How to compare two branches in github with GraphQL?

社会主义新天地 提交于 2021-01-29 05:15:15
问题 Can we compare two branches with the Github GraphQL? From their v3 rest API, you can do: /repos/:owner/:repo/compare/:base...:head (docs: https://developer.github.com/v3/repos/commits/#compare-two-commits) and this works with SHA's, branches, tags, etc. However, I'm unable to find it's equivalent GraphQL query in the docs. This is my attempt so far : I'm able to get the list of commits for each branch seperately, however, the entire history is loaded and I would only like the difference

Git - How to split a branch to it's own repository?

空扰寡人 提交于 2021-01-29 03:44:58
问题 I have a repository where a branch ( admin ) has been branched out from develop at some point. It looks roughly like this develop c2 c4 c5 *------------*---------*---------*------------... c1 \ \____________________*c3 admin I want the develop branch to stay the same and admin branch should have it's own repository. For the record, I'm using sourcetree+bitbucket. I tried the method mentioned in this answer and tried git push url://to/new/repository.git admin:develop . What it did in my new

Group git branches

为君一笑 提交于 2021-01-28 18:46:47
问题 I've taken over a big git repository with lots of branches that no one really seems to know what they are all about. Is there any way to put branches in some kind of grouping or folder so that they are still there but not necessarily listed? To make the important branches easier to spot. Edit: I want to be able to distinguish between the branches that I work with and the branches that don't really make sense to me but still can't be deleted. 回答1: Delete the branches. If nobody knows what they

Git branch vs Git fork

被刻印的时光 ゝ 提交于 2021-01-27 22:00:21
问题 I have a general doubt. Suppose there is a git repo with master branch as development branch and you want to make some changes without effecting master branch and then you want to merge it later. What is the better approach? Create new branch in same repo and then merge it to master. Create new repo by forking and then merge it to master. 回答1: If you know for sure that you will end up merging with the master branch eventually and/or your change is relatively small (bug fixes, new features),

Understanding “git remote show” command output… Which is the meaning of: “Local ref configured for 'git push'”?

本秂侑毒 提交于 2021-01-21 10:12:15
问题 I have two remotes and two local branches: local branch "master" is tracking remote branch "origin/master" local branch "mirror" is tracking remote branch "github/master" This is in my .git/config file: ... [remote "origin"] url = http://my.gitlab.com/nandoquintana/repo.git fetch = +refs/heads/*:refs/remotes/origin/* [remote "github"] url = https://github.com/nandoquintana/repo.git fetch = +refs/heads/*:refs/remotes/github/* [branch "master"] remote = origin merge = refs/heads/master [branch