Git Stuff

- - posted in git | Comments

Remove untracked files

1
git clean -f -d

This will remove all untracked files and directories, great it you run a generator without thinking!

Displaying history and status

1
2
git log --oneline --decorate
git status -sb

Delete all merged branches

To how all merged branches:

1
git branch --merged

To delete all merged branches:

1
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d

Branches containing commit

1
git branch --contains <commit>

Quickly rebase a feature branch

While on a feature branch instead of switching to the next branch, pulling, swithcing back to the feature branch and doing a rebase just do:

1
git pull --rebase origin next

Checkout a remote branch

1
git checkout -b second/next second/next

This checkout the next branch on the remote named second in to a local branch named second/next, which will not comflict with an existing local branch named next.

Comments