Difference between revisions of "Git"
Jump to navigation
Jump to search
(One intermediate revision by the same user not shown) | |||
Line 18: | Line 18: | ||
Launch Git Gui. | Launch Git Gui. | ||
− | Create New Repository. | + | Create New Repository.b |
Specify path. | Specify path. | ||
Line 63: | Line 63: | ||
$ git add . | $ git add . | ||
</pre> | </pre> | ||
+ | . = Current directory | ||
* Check status | * Check status | ||
Line 71: | Line 72: | ||
* Commit | * Commit | ||
<pre> | <pre> | ||
− | $ git commit -m | + | $ git commit -m "Initial Commit" |
</pre> | </pre> | ||
+ | -m = Message | ||
+ | git commit = Local commit | ||
+ | git push = Sync up with remote repository | ||
+ | |||
+ | * View log | ||
+ | <pre> | ||
+ | $ git log | ||
+ | commit 217d58e0f073e9249cca5ae1e05322340abd5034 | ||
+ | Author: Chris | ||
+ | Date: Mon Jan 30 17:05:03 2012 -0600 | ||
+ | |||
+ | Initial Commit | ||
+ | |||
+ | ~/Documents/Rails_Projects/first_app (master) | ||
+ | </pre> | ||
+ | |||
+ | * Restore the deleted file | ||
+ | <pre> | ||
+ | $ rm -rf *.rb | ||
+ | |||
+ | $ git status | ||
+ | # On branch master | ||
+ | # Changes not staged for commit: | ||
+ | # (use "git add/rm <file>..." to update what will be committed) | ||
+ | # (use "git checkout -- <file>..." to discard changes in working directory) | ||
+ | # | ||
+ | # deleted: application_controller.rb | ||
+ | # | ||
+ | no changes added to commit (use "git add" and/or "git commit -a") | ||
+ | |||
+ | $ git co -f | ||
+ | |||
+ | $ ls | ||
+ | 03/01/2012 02:37 PM 80 application_controller.rb | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | == Github == | ||
+ | Coming soon |
Latest revision as of 15:51, 1 March 2012
Git
Git is an open-source, distributed version control repository system.
Installing Git
http://progit.org/book/ch1-4.html
Installing Git on Windows
- http://code.google.com/p/msysgit
- https://github.com/msysgit/msysgit/wiki/InstallMSysGit
- http://code.google.com/p/msysgit/downloads/list
- Download Installer and run it.
- Choose all default settings (for now).
Repository
Launch Git Gui.
Create New Repository.b
Specify path.
Syntaxes
- Cretae an alias for check out.
$ git config --global alias.co checkout
- Set the default editor.
$ git config --global core.editor notepad++.exe
- Initialize git for the first time.
$ cd first_app $ git init Initialized empty Git repository in ../Rails_Projects/first_app/.git/
- Add the ignore list.
$ cd first_app $ vi .gitignore $ cat .gitignore .bundle db/*.sqlite3* log/*.log *.log /tmp/ doc/ *.swp *~ .project .DS_Store
- Add all
$ git add .
. = Current directory
- Check status
$ git status
- Commit
$ git commit -m "Initial Commit"
-m = Message git commit = Local commit git push = Sync up with remote repository
- View log
$ git log commit 217d58e0f073e9249cca5ae1e05322340abd5034 Author: Chris Date: Mon Jan 30 17:05:03 2012 -0600 Initial Commit ~/Documents/Rails_Projects/first_app (master)
- Restore the deleted file
$ rm -rf *.rb $ git status # On branch master # Changes not staged for commit: # (use "git add/rm <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # deleted: application_controller.rb # no changes added to commit (use "git add" and/or "git commit -a") $ git co -f $ ls 03/01/2012 02:37 PM 80 application_controller.rb
Github
Coming soon