Creating an Orphan or Empty Git Branch
Sometimes you may want to make a completely empty git branch in your repo. This is how you can do it.
These entries have all been tagged with “git”.
Sometimes you may want to make a completely empty git branch in your repo. This is how you can do it.
Since git does not store folders specifically (just path information), if you need an empty folder in your project that can be hard. Especially if that folder needs git to ignore any content inside of it. A community convention to solve this challenge has been the .gitkeep
file. This is not part of the spec, combining that file with various .gitignore
rules can solve this problem. But, there’s a better way.
I had a need to mirror a git repository on Github, but I wasn’t allowed to fork the repository. Luckily, there is a mirror option built into git.
I’m a sucker for those little badges at the top of the README files in Github repos. I know you can get them from external services, but could I host my own? Let’s find out.
Github is one of the most useful tools I have in my arsenal. With over 100 repositories (some of which are private), it’s the best $7/mo I spend. However, there are a couple things about Github you might not know.
I manage any WordPress plugins I create using git. In order to create a distribution of those, I need to zip up the source code and use that to upload to the marketplace (or directly upload). This was easy with SVN - I just used an svn export command and there we go.
At my current job, we keep both a private copy of the code in BitBucket (where all of our code resides), and make a few repos public on GitHub. (Wish I didn’t have to do that, but really, GitHub is the premier place to get your code it seems these days.) So, I decided to come up with a solution to keep both repos up to date as I do my development.
Do you use Git to manage your repository? If so, do you use it to check out code onto the server as well? If you do, you really should restrict access to your .git
directory if it’s in your public root. (If you’re using things like Zend Framework, chances are your root directory is not your public directory, so you have less to worry about.)