Git encourages branching but sometimes you need to do a clean up and delete merged or orphaned branches from your local and remote repositories. Here is the procedure from the command line.
To delete a branch locally:
git branch -d branchname
You may get an error like this one if the branch has not been merged yet:
error: The branch 'branchname' is not fully merged.
If you are sure you want to delete it, run 'git branch -D branchname'
This is a good reminder in case you are deleting something you should not be deleting.
To delete a branch remotely (e.g. on a GitHub repository):
The other day I had to do an svn checkout from an Amazon Web Services (AWS) instance and, of course, my user name on SVN was different from the user name on the AWS instance which is by default ec2-user. So how to do a checkout from a Subversion repository and specify at the same time the SVN user who is performing the checkout? Subversion has a handy username parameter, here is the full command with some dummy output.
[ec2-user@ip-172-31-9-166 ~] $ svn checkout --username mysvnusername http://www.example.org/mysvnrepository
Authentication realm: <http://www.example.org:80> USVN
Password for 'mysvnusername': **********
-----------------------------------------------------------------------
ATTENTION! Your password for authentication realm:
<http://www.example.org:80> USVN
can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details.
You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/home/ec2-user/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? no
A mysvnrepository/file
Checked out revision 3027.
You will be asked to enter your SVN password and if you want to store your password unencrypted. I suggest to select no for the latter for security reasons but this means that you will need to provide the SVN password every time you perform an SVN command.