Note for me, how to tag with git. Because I always forget it!
git tag -a v1.4 -m 'version 1.4'
The first line creates a tag with the annotation (-a) v1.4 and the message (-m) “version 1.4”. And this line pushes the tag to origin master.
git push --tags
I just installed Mac OS X Mountain Lion, as an update via the app store. Worked pretty good. After less than 30 min it was installed. Everything worked. I just missed the command line tool git.
To fix that issue I had to install the newest XCode version and XCode command line tools. The XCode command line tools you can install inside from XCode. Just go to preferences and Downloads and then you will see it.
That worked for me.
If you make changes on your local repository you can add all your changes to your local history with
git add .
With the . you add all new files to the local history. With this command you commit everything to your local git repository.
git commit -m "new changes"
You can do multiple commit. If you feel you are done and everything is good enough to share it with your co-workers you can push all your commits to the server.
If you want the updates from your co-workers you have to pull the changes.
Git pull is similar to svn update.
github.com is a pretty good git repository server for open source projects. If you have an account you can add easily a project to your github repo. At first generate the git project by executing this line in your project root:
than add all files from your project to your local git repo:
git add .
Than commit everything to your local git repo:
git commit -m "init"
OK. Now you can connect your local git repo with your remote git repo by github.com
git remote add origin firstname.lastname@example.org:<username>/<projectname>.git
Just replace “username” with your github username and “projectname” with your projectname on github. Now you can push your changes to the github repo.
If you want that git is ignoring some files for you you just have to create the “.gitignore” file in your project root. Here you can add all the files you don’t want have in your git repository. For example some meta files from IntelliJ IDEA.
Just go into the directory you want to have version control for and type in:
This will create an empty git repository on your hard disk. With this command
git add .
you can add all files in the directory to the git repository. And with
git commit -a -m "init"
you can commit all files to your local repository.
Just go into the root directory of your project and type in:
git checkout -b branch1
That’s all. Now your created a new branch with the name “branch1”. Your working directory is now the branch.
You can commit your changes like this:
git add .
git -a -m "my changes"
After the commit you can switch to the master with this command:
git checkout master
Now you are again on the master branch. If you want to merge your two branches you can do it in this way:
git mege branch1