Linked Questions
180 questions linked to/from How do I delete a Git branch locally and remotely?
15
votes
3
answers
13k
views
What's the use case for "git branch -d"
I was helping out a co-worker today, and discovered that git branch -D and git branch -d do slightly different things. From the git help documentation:
-d --delete delete fully merged branch
-D ...
18
votes
2
answers
15k
views
List and delete git branches without cloning
for k in $(git branch -r --merged origin/master | cut -d" " -f 3); do
echo $k
done
I have a list of git projects that i want to clean up old branches in, what i want to do is list and delete all ...
17
votes
3
answers
14k
views
How do you merge changes on non-master branches from a forked github repository?
In both of the following StackOverflow questions, the accepted answer describes how to merge changes from a forked repository in the situation where you fork a repo, the original repo is modified, and ...
18
votes
2
answers
13k
views
Remove a single merged branch from master branch
In my master branch, there're following local branches that have been merged, but I would like to remove the local_branch3 from master:
local_branch1
local_branch2
local_branch3
local_branch4
after ...
15
votes
2
answers
7k
views
How to forcefully delete a remote branch in GitHub?
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 ...
17
votes
3
answers
6k
views
What happens to a git branch after delete if it was not merged?
I have a small repo with a master and an experimental branch for trying out some new features. I decided not to implement those features on the master.
What happens to the commits of the ...
21
votes
5
answers
13k
views
Github release a specific folder
I have a repository that has a bunch of folders, but I want to create releases for just one of those folders.
Simpler story, it's for a gaming server, and I just want to create releases for the ...
12
votes
1
answer
11k
views
delete remote branch origin
I deleted a branch with :
git branch -d branch_name
And I pushed, but when I list the branches with :
git branch -avv
I see that the branch is always present with the name remotes/origin/...
17
votes
1
answer
19k
views
Guidance on main and master branch in github
I had created a remote repository in Github and pushed my project into that remote repository. After pushing it, a new branch is created master and now I have two branches main and master. The default ...
11
votes
1
answer
6k
views
What does this mean from a security perspective: "Caution: This repository is private but the published site will be public."
I've got a repo that will contain sensitive information, so in GitHub I made it private. After doing so, however, this message is now displayed:
Caution: This repository is private but the published ...
11
votes
2
answers
6k
views
Git: How to properly merge two functional and quite different branches?
Imagine a situation where you have two branches of the same project, with one part of the first branch dramatically refactored over the other one. But for a while you need to keep both branches ...
8
votes
3
answers
10k
views
My Github repo has 'main' and 'master' branches - what is their purpose?
I was trying to push some local unversioned code into a repo and get it up onto GitHub for accessibility reasons.
I followed the suggestions here
cd <local_dir>
git init
git add .
git commit -m &...
14
votes
2
answers
6k
views
How do you remove a branch and all of its history locally and remotely?
I have a git branch I need to nuke all traces of. I think I need something like
git filter-branch --index-filter 'git -D <branch>' --tag-name-filter cat -- --all
or maybe
git filter-branch --...
2
votes
3
answers
11k
views
Git branch still exists after deleting locally and remotely
I have a development branch called Atomics (more correctly, atomics). Its finished being developed. It tested OK, so it was merged into Master. I'm now ready to completely delete it since its no ...
6
votes
1
answer
4k
views
'git branch -a' still showing deleted remote branch in the remote repo?
I have uploaded (pushed the entire local branch) to the remote repo.
I have merged it with master and deleted it in the remote repo (on github.com)
Running git branch -a still shows it in the console:...