As promised in blog post my “Distributed Version Control with Git” is now also available as paper version.
Thanks again to my reviewer: Matthias Sohn, Dirk Fauth, Dariusz Luksza, Thanh Ha, Krzysztof Daniel, Stefan Lay and Dr Alex Blewitt.
You find the Kindle version in your local Amazon store.
Distributed version control with Git at Amazon.com
Distributed version control with Git at Amazon.de
Distributed version control with Git at Amazon.fr
Distributed version control with Git at Amazon UK
This book is based on my online Git tutorial.
You can enable auto-completion for Git commands in the bash shell. For this copy the following file to your home directory under the name “.git-completion.bash”.
git-completion.bash in the main Git repository.
Afterwards add the following lines to your .bashrc file and restart the bash.
if [ -f ~/.git-completion.bash ]; then
Now you have code completion, e.g. if you type git c and press tag you see the possible values.
vogella is proud to announce that Stefan Lay joins us and enforces the trainer team of vogella.
Stefan is initial committer in the Eclipse projects EGit and JGit since May 2009.
He has more than ten years experience as a professional Java developer and joined SAP AG in 2005. At SAP he works in the Department of Infrastructure Development. In this context, he supports, among other things, the development department for working with Git and delivers Git training.
He is a regular speaker at international conferences such as EclipseCon, the Developers’ Day, the Gearconf and Eclipse demo camps. At EclipseCon he held already four times in a row a four-hour Git tutorial.
Stefan has a deep background in Git and Java development and will help to deliver the vogella Git training.
If you have local changes in your Git repo and pull in new changes from your remote repository, Git will per default create a merge commit for the pulled changes. This can clutter your history with unnecessary commits.
To rebase your local changes on top of the pulled changes, you can use:
git pull --rebase
To activate this for all new branches.
git config --global branch.autosetuprebase always
To update existing branches in your Git repo use the command:
git config branch.<name>.rebase true
Not everyone likes rebase. Here is a little summary why Linus Torvalds doesn’t like rebasing: http://kerneltrap.org/Linux/Git_Management.
Just in case you missed it, there is a prototype for a Mylyn and Github connector available. Please see https://github.com/blog/852-github-mylyn-connector-for-eclipse for the official announcement.
Installing the connector is pretty straight forward you can directly install it from the Eclipse Marketplace client. The only pre-requisite is that you add the Orbit repository http://download.eclipse.org/tools/orbit/downloads/drops/S20110422041657/repository/ and install “Gson” from the com.google.* category (thanks to Christian Trutz for the tip on twitter).
Importing your issues is as easy as File -> Import -> Tasks -> Github Task Repositories and then you can define new queries for this repository.
The first test unfortunately failed. During a submit of a new issue with the error “Submit failed: Unexpected error: Unprocessable Entry”.
Still the connector looks very promissing. Git is my favorite version control system and I love Github. Its great that soon Mylyn will also to share issues and ther context via GitHub.
I suggest you give it a test run. If you find issues you can report them in bugzilla: Mylyn EGit Connector.
Update: The bug is already fixed, looks like testing will get your bugs solved fast.
In in 95% of my time I type “git add . -A” directly followed by “git commit -m “message” in the Git version control system.
That is a lot of typing for a very common case. Fortunately git allows to add an alias for the command. To add an alias for git add and git commit to your git configuration, open your .git/config file and add the following.
ac = !git add -A && git commit
Alternative you can use the –global flag from the command line:
git config --global alias.ac '!git add -A && git commit'
You now can add and commit to your Git repository via the command:
git ac -m "message"
Unfortunately alias seems not to be supported on the window implementation of git (msysgit). See the bug report: msysgit does not support alias definition.
I hope this helps. More details can be found in my Git Tutorial. You may want to follow me on Twitter.
Git is one of the greatest distributed version control system and EGit will pave the road to success for Git in the Eclipse world.
But some things make the usage of Git difficult for new starters. I would like to highlight one particilar case; how to add files to the index. The approach differs based on the situation. New files, deleted files and already commited files are treated differently. In my opinion Git is missing one command to add all changes to the index including deleted, changed and new files. Even better git should have a commit command which add everything to the index and commits it. Experts may want finer control but in my opinion this missing option makes it hard for new starters.
Perhaps git will add such a feature in the future, in my humble opinion the power of a complex workflow should not be payed with the lack of simplicity.
The following command will add everything to the index except deleted files.
git add .
Unfortunately IMHO there is not “git add .” for removed files. You can not tell git to add all files which are deleted to the index via wildcards. The following will not work, you need to specify the files individually.
git rm .
The starter may think I just use git commit -a to do all this adding and deleting. Unfortunately this will only add deleted files and files which are already commited to the index. New files are not included.
git commit -a -m "message"
If you want always to add your deleted files and as well as stage files what are already commited you should use the following command. This will not add new files to the index. Thanks to Heath Borders for the clarification on this command.
git add -u .
I hope this helps, at least I got stuck for a while in these suble but important differences. Handling this example and much more can be found in my Git Tutorial.
Btw. please don’t get me wrong I like having all these options but in addition to these option I believe git would be easier if it had one “add-it-all” option.
You find me also on Twitter .
Since beginning of last year I participate more or less actively in the Java User Group Mannheim. Unfortunately the former main contact of the Java User Group Mannheim Alex Hanschke has moved out of the area.
Benjamin Muskalla and myself volunteered to help organize the JUG Events. Therefore Benny and I will as of now try to find great new speakers and setup cool events. I think we are starting very well, as we are proud to have Matthias Sohn and Stefan Lay speak about Git and EGit on the 02.Sept. Git is one of the leading distributed version control systems and EGit a team provider for Eclipse.
Matthias and and Stefan are both committers in the EGit project. Details on Matthias and Stefan and the presentation can be found on the Majug Event Announcement. As usual we organize to have drinks after the event and hope Matthias and Stefan will be able to join so that you can bugger them with questions. The presentation will be in German.
Rumors are that we will see a real merge via EGit on this event… Hope to see you at their.
I learned from Steffen Pingel and Ekkehard Gentz that Mylyn has the ability to save local tasks outside the workspace. This is hidden under advanced in the Preferences.
This allows you to put your local tasks outside your workspace and versionize them with git. This way you can use git to move your local tasks between machines. I really like this as I frequently use different machines and now I can not only share source code betwee them but also my mylyn taslks.
As Steffen told me, simultanous access to the Mylyn tasks might cause task corruption but I don’t think that is an issue for me as Git takes care of conflicts and I do not have two machines writing to the same local file.
Fun times with Git and Mylyn!
Unfortunately the Eclipse team provider EGit does currently not support to use HTTPS for cloning and pushing.
Fortunately the Git command line supports this (under Linux without problems).
git clone https://email@example.com/vogella/de.vogella.rcp.example.git
// do some changes
git push https://firstname.lastname@example.org/vogella/de.vogella.rcp.example.git
If you are on Windows and if you are using msysGit then you may receive the following error:
error: error setting certificate verify locations:
while accessing your_repo
If you have this error you can disable ssl verification to solve it.
git config --global http.sslverify "false"
After this change cloning and pushing works via https on Windows.
Alternative the following should also make msysGit work, but I didn’t test these approaches.
copy C:\Program Files\Git\bin\curl-ca-bundle.crt to c:\bin\curl-ca-bundle.crt
git config --system http.sslcainfo \bin/curl-ca-bundle.crt
The full discussion of the msysGit issue can be found here.
[Update:] If you are behind a http proxy you can set the proxy via the following command:
git config --global http.proxy http://proxy:8080
// To check the proxy settings
git config --get http.proxy