mirror of
https://gitlab.com/ric_harvey/git-guide.git
synced 2024-11-23 20:24:02 +00:00
add info for deleting branches
This commit is contained in:
parent
65fd405063
commit
fbf8bd293a
1 changed files with 19 additions and 0 deletions
19
branches.md
19
branches.md
|
@ -83,6 +83,25 @@ Your branch is up to date with 'origin/main'.
|
||||||
ls
|
ls
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Deleting a local and remote branch
|
||||||
|
|
||||||
|
To delete a local branch you simple run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Make sure you are in the main branch
|
||||||
|
git checkout main
|
||||||
|
# Delete a local branch
|
||||||
|
git branch -D demo-branch
|
||||||
|
```
|
||||||
|
|
||||||
|
You'll get a confirmation that the local branch has been deleted. But now is a good time to clean up the remote branch, you can do this by running the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git push origin --delete demo-branch
|
||||||
|
```
|
||||||
|
|
||||||
|
Now if you check back in the web gui you'll see only the main branch exists.
|
||||||
|
|
||||||
---
|
---
|
||||||
##### Follow me for more guides
|
##### Follow me for more guides
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue