This repo contains a few files and scripts to help you use git. It is designed to let you, with one command:
- Create a git repo of the contents of the local directory and have that setup on your remote "origin" server as well with the same branch.
- Easily create a local tracking branch to a new remote branch.
- Easily export the entire project to a tarball to give to someone (ie client).
I have shared these methods/scripts with enough people that I'm just putting it up publicly.
You should backup your ~/.gitignore file before doing anyting else with this information/scripts in this git repo.
Again, BACKUP your gitignore file before going any further.
If you run the ./install.sh it will replace your .gitignore with ours and copy all the git-* shell scripts to your ~/bin directory. (It's assumed you have your local account's PATH environment variable set to use ~/bin as one of it's locations). However, please read this entire document before you run "./install.sh", because there are configurations you can make in the next step and then run the install to make it easer on yourself.
If you want to be able to create a repo w/ a remote origin repo all in one step with the git-startrepo command, then you will have to do some setup work by hand:
- edit "creategitrepo.sh" and replace "{username}" with your account's name and "pathtorepos" to the path where you keep your git repo's.
- scp "creategitrepo.sh" to your remote machine's account's "~/bin/" directory
- verify that "~/bin/creategitrepo.sh" on your remote machine's account is +x excecutable bit ON. (ie chmod +x)
- edit the "git-startrepo" script on your local machine and replace the following with relevant information:
A. {username} B. {hostname} C. {pathtogitrepos}
I typically do the following:
- mkdir ~/projects/foo
- create new Xcode project in ~/projects/foo
- new terminal window, cd ~/projects/foo
- git-startrepo mynewcoolprojectfoo
- git-create-branch initialdevelopment
If you are like me, you will clone many github repo's to your local computers. (I typically do this thinking "Oh this looks like an interesting project", I put them all in ~/code and I've got a lot of repo's there that I still have never looked at).
I want them updated. I don't want to have to cd foo && git fetch && cd .. && cd bar && git fetch.
So there is the git-fetch-dirtree command. It will attempt a git-fetch --all on any git repository found in directories one-level below the current directory path (when the script is run). To use:
- cd ~/code
- git-fetch-dirtree
Note that it only does one level, so as not to update your git-submodules.
It is assumed that you've already setup your git repo's, exchanged your .ssh keys etc, prior to messing with this.
If you have any suggestions for the gitignore file, or any of this for that matter, please contact me!
Version 0.1 @ 2010-03-17
- Initial release.