-
Notifications
You must be signed in to change notification settings - Fork 142
Git tips
Daniel Khashabi edited this page Nov 21, 2016
·
2 revisions
If you want to remove a mistake from history (something already committed and pushed):
git reset --hard <the-sha-you-want-to-return-to>
git push -f <remote> <branch>
git checkout -b <name_you_want_to_call_it_locally> <remote_name_you're_reading_from>/<name_of_remote_branch>
If you want to rename a branch while pointed to any branch, simply do :
git branch -m <oldname> <newname>
If you want to rename the current branch, you can simply do:
git branch -m <newname>
git branch -d <name-of-branch-to-be-removed>
And for deleting the remote branch:
git push <namre-of-remote> --delete <name-of-branch-to-be-removed>
To remove a local branch from your machine:
git branch -d <the_local_branch>
To remove a remote branch from the server:
git push origin :<the_remote_branch>
git count-objects -vH
As of Nov 20, 2016:
count: 494
size: 2.01 MiB
in-pack: 22842
packs: 10
size-pack: 28.47 MiB
prune-packable: 50
garbage: 0
size-garbage: 0 bytes