You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Apache Wiki <wi...@apache.org> on 2015/01/07 15:24:45 UTC

[Commons Wiki] Update of "UsingGIT" by BerndEckenfels

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Commons Wiki" for change notification.

The "UsingGIT" page has been changed by BerndEckenfels:
https://wiki.apache.org/commons/UsingGIT?action=diff&rev1=3&rev2=4

Comment:
wikified links, formatted commands, use https instead of http, explain offline, explain staging

  = Overview =
- Some of the Apache Commons components use [http://git-scm.com/ GIT] Source Code Management System instead of [http://subversion.apache.org Subversion].
+ Some of the Apache Commons components use [[http://git-scm.com/|GIT]] Source Code Management System instead of [[http://subversion.apache.org|Subversion]].
  
  Both systems allow collaborative development and both systems maintain an history of file changes. There are however several differences.
  
  = Distributed Version Control =
  Git is a distributed version control system. This means that instead of a single central repository holding the full history of project
- files and numerous clients connecting to it to check out some versions, Git uses a symetrical view were everyone connecting to the
+ files and numerous clients connecting to it to check out some versions, Git uses a symmetrical view were everyone connecting to the
  repository clones the full history and from then on could (at least theoretically) act as a new server that another user could clone
  and so on. Each repository is created by cloning an ''origin'' repository. Once cloned, the ''origin'' repository is the first
  ''remote'' repository known to the clone. It is possible to add later on several other ''remote'', so a complete web of repositories
  can be created. Of course, for collaborative development, some policy has to be decided and modifications made by one user on its own
  cloned repository must be ''pushed'' back to a public repository.
  
- At Apache, the policy is that the official reference is the one hold by Apache servers (for example http://git-wip-us.apache.org/repos/asf/commons-math.git).
+ At Apache, the policy is that the official reference is the one hold by Apache servers (for example https://git-wip-us.apache.org/repos/asf/commons-math.git).
  Therefore, all users who want to get the latest version know this is were they should point at to retrieve it,
  and developers who have commit access must push their modifications back to this repository for official publication.
  
@@ -27, +27 @@

  review the work would declare this repository as a remote for his own working clone and would ''pull'' the proposed changes. He could
  review everything on his computer, and if satisfied could ''push'' the to the Apache ''origin'' repository, as he has write access
  to it. In a way, the Apache committer acts here as a proxy for the contributor, and makes sure everything is good to include.
+ (Consequently Git can have different authors and commiters of a commit. If pulled in as git-patch or pull request the author is preserved).
  
  A second use case is an Apache committer working either on a long experimental stuff not yet ready for publication or working
  without internet access for some time (typically during a business trip). In both cases, the committer would simply commit
@@ -41, +42 @@

  
  = Git References =
  
- There are numerous references available online for Git. The first one is the official [http://git-scm.com/book/en/ Pro Git book].
+ There are numerous references available online for Git. The first one is the official [[http://git-scm.com/book/en/|Pro Git book]].<<BR>>
- An Apache specific page is [https://git-wip-us.apache.org/ here]
+ An Apache specific page is [[https://git-wip-us.apache.org/|here]].<<BR>>
- There is also a wiki at kernel.org: [https://git.wiki.kernel.org/ Git Wiki Homepage]
+ There is also a wiki at kernel.org: [[https://git.wiki.kernel.org/|Git Wiki Homepage]].<<BR>>
- Also a quick tutorial on [http://git.or.cz/course/svn.html Git for SVN users]
+ Also a quick tutorial on [[http://git.or.cz/course/svn.html|Git for SVN users]].
  
  = Comparison with subversion commands =
  
@@ -55, +56 @@

  computer and making it available to other people who see only public remote computers. The first action is called ''commit'',
  and it is therefore completely different from a subversion commit. The second action is called ''push''. The equivalent
  to svn commit is therefore a pair of two commands, git commit followed by git push. It is possible to perform several
- git commits without doing any git push, which is impossible to do with subversion.
+ git commits without doing any git push, which is impossible to do with subversion. Note that most commands (including `log`
+ and `status`) only work on the local copy of a remote repository. You should therefore use `git fetch` regularly to refresh your
+ copy (if you do not want to `pull`).
  
-  * svn checkout <repo-url>
+  * `svn checkout `''repo-url''
-    git clone http://git-wip-us.apache.org/repos/asf/commons-math.git
+    `git clone https://git-wip-us.apache.org/repos/asf/commons-math.git`
  
-  * svn diff
+  * `svn diff`
-    git diff
+    `git diff` (shows only unstaged changes, `git diff --cached` shows prepared commit)
  
-  * svn update
-    git pull
+  * `svn add`
+    `svn add` -- used to stage for commit
  
-  * svn commit
-    git commit, followed by git push
+  * `svn update`
+    `git pull`
  
-  * svn status
-    git status
+  * `svn commit`
+    `git commit`, followed by `git push`. You need to stage (aka `add` all files which should be commited)
  
-  * svn revert ''path''
-    git checkout ''path''
+  * `svn status`
+    (optionally refresh local state `git fetch` then) `git status`
  
+  * `svn revert `''path''
+    `git checkout -- `''path''
+ 
+  * `svn info`
+    `git remote -v` and `git remote origin`
+ 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org