Archive

Posts Tagged ‘Git Shell’

How to delete/prune old local git branches

October 27th, 2018 Comments off

When you delete a branch with git, and push those changes, you might see that your local repo still has that branch in the list

What this basically does is fetch all the branches and all the ones with a ‘gone’ attribute, (meaning deleted remotely), then we will remove them.

You can view the branches and what their attribute is yourself by typing

Of course, you need to prune the branches on the remote git server

To make sure all is good, just re-list your branches, (local and remote)

Categories: Cheat-sheet, development Tags: ,

Using Github from command line

June 11th, 2016 Comments off

This assumes that you have all the permissions needed to access your repo, (passwords and so on).

Start Git Shell and navigate to your local repo.

Create a branch

git checkout -b <branch-name>
git push <remote-name> <branch-name>

In the case of github the remote name is ‘origin’

Source

Add your changes to the branch

git add .

The ‘.’ means ‘everything’ that was changed.

You can use ‘status’ to check what needs to be staged, (or what has been staged).

git status

Commit branch

git commit -m "You message here"

Push branch
The first time you need to tell where you are pushing this to.

git push --set-upstream <remote-name> <branch-name>

The afterwards you just need to do…

git push

Delete your branch

To remotely delete it

git push <remote-name> --delete <branch-name>

To locally delete it


git branch --delete <branch-name>

Source

Categories: Cheat-sheet, development Tags: ,