12,301
edits
mNo edit summary |
No edit summary |
||
| (11 intermediate revisions by 2 users not shown) | |||
| Line 19: | Line 19: | ||
<source lang="bash">git remote add origin ssh://myserver.com</source> | <source lang="bash">git remote add origin ssh://myserver.com</source> | ||
For example, you can use [https://github.com/ github.com] to host your open source projects, or [https://bitbucket.org/ | For example, you can use [https://github.com/ github.com] to host your open source projects, or [https://bitbucket.org/ bitbucket.org]. You will find an excessive online help on how to setup a remote server on github: [http://help.github.com/set-up-git-redirect How-to-Setup github]. Basically, you only need a private/public ssh key and a valid user account. | ||
But remember, you can use git only on your local computer as well, it is not required to have an online server! | But remember, you can use git only on your local computer as well, it is not required to have an online server! | ||
| Line 37: | Line 37: | ||
or to add all: | or to add all: | ||
<source lang="bash">git add | <source lang="bash">git add .</source> | ||
| Line 47: | Line 47: | ||
At this point, your commit is only local! You can commit as few or as many changes as you like. But at the end of the day, you should push your changes to the server: | At this point, your commit is only local! You can commit as few or as many changes as you like. But at the end of the day, you should push your changes to the server: | ||
<source lang="bash">git push origin | <source lang="bash">git push origin main</source> | ||
| Line 77: | Line 77: | ||
So: forget CVS and SVN, with GIT there's really no excuse to not use a versioning systems anymore. There is also bazaar, which claims to be even easier than GIT, but isn't as widely adopted. | So: forget CVS and SVN, with GIT there's really no excuse to not use a versioning systems anymore. There is also bazaar, which claims to be even easier than GIT, but isn't as widely adopted. Mercurial is another version control system which is becoming more and more popular. | ||
== Summary == | == Summary == | ||
| Line 84: | Line 84: | ||
* git != github.com | * git != github.com | ||
** git is a local version control software. You have to install git locally on your machine | ** git is a local version control software. You have to install git locally on your machine | ||
** then (!) you can (!) add remote git servers to your local repository. This is where github, gutbucket & co (or your own git-server) come into the game | ** then (!) you can (!) add remote git servers to your local repository. This is where github, gitlab, gutbucket & co (or your own git-server) come into the game | ||
** but then again, git works fine just locally. You do not need to use a remote server, nor do you have to use github or any other service provider. | ** but then again, git works fine just locally. You do not need to use a remote server, nor do you have to use github or any other service provider. | ||
* the most important commands you want to remember are | * the most important commands you want to remember are | ||
| Line 100: | Line 100: | ||
** In fact, commit after every small step and try to be as accurate as possible on your commit messages. | ** In fact, commit after every small step and try to be as accurate as possible on your commit messages. | ||
* Branch! | * Branch! | ||
** Whenever you want to try something or are faced with the need to add, change or delete more than one or two files: create a new branch. It's easy, lightweight and you can revert or merge at any point. | ** Whenever you want to try something or are faced with the need to add, change or delete more than one or two files: create a new branch. It's easy, lightweight and you can revert or merge at any point. | ||
== Tutorial == | == Tutorial == | ||
| Line 108: | Line 108: | ||
== Links == | == Links == | ||
* [http://git-scm.com | * [http://git-scm.com git-scm] – Official Project Page | ||
* [http://gitref.org | * [http://gitref.org gitref.org] – Git Reference | ||
* [http://git.or.cz/course/svn.html gir.or.cz Crash Course] about git | * [http://git.or.cz/course/svn.html gir.or.cz Crash Course] about git | ||
* [https://github.com/ | * [https://github.com GitHub] | ||
* [https://bitbucket.org/ | * [https://gitlab.com gitlab] | ||
* [https://bitbucket.org Bitbucket.org] (Also works with Mercurial) | |||
* [http://pcottle.github.io/learnGitBranching Learn Git branching] – nice interactive branching tutorial | |||
== Literature == | == Literature == | ||
| Line 120: | Line 122: | ||
[[Category:Programmiersprachen]] | [[Category:Programmiersprachen]] | ||
[[Category:Michael Markert]] | [[Category:Michael Markert]] | ||
[[Category:HowTo]] | |||