summaryrefslogtreecommitdiff
path: root/_posts
diff options
context:
space:
mode:
authorEston Bond <eston@github.com>2010-10-14 14:10:09 -0700
committerEston Bond <eston@github.com>2010-10-14 14:10:09 -0700
commit2ebe7d9277edc642a3ddebe0ea087afca572c93c (patch)
treec583f1858f4e7ff5615b7e50a2bff0a5e9e0efb1 /_posts
parent786b6460d09bcd559cda1777d4cae175de0cd802 (diff)
HAY GUYZ ITS LIKE ALL CAPZ IN HEAR
Diffstat (limited to '_posts')
-rw-r--r--_posts/2010-10-14-git-cheat-sheets.textile121
1 files changed, 56 insertions, 65 deletions
diff --git a/_posts/2010-10-14-git-cheat-sheets.textile b/_posts/2010-10-14-git-cheat-sheets.textile
index f283062..2e37b91 100644
--- a/_posts/2010-10-14-git-cheat-sheets.textile
+++ b/_posts/2010-10-14-git-cheat-sheets.textile
@@ -49,11 +49,11 @@ You can download PDF or LaTeX source:
* "http://www.xcombinator.com/wp-content/uploads/2010/09/git-class-cheat-sheet.pdf":http://www.xcombinator.com/wp-content/uploads/2010/09/git-class-cheat-sheet.pdf
* "http://github.com/jashmenn/talks/raw/master/git/cheat-sheet/git-class-cheat-sheet.tex":http://github.com/jashmenn/talks/raw/master/git/cheat-sheet/git-class-cheat-sheet.tex
-h2. A Practical Git GUIDE
+h2. A Practical Git Guide
(credit: notes extracted from GIT screencast at http://www.peepcode.com.)
-h3. CONFIGURE
+h3. Configuration
identify yourself to git: email and your name
@@ -69,15 +69,15 @@ OR
@cat .git/config@
-h4. SET UP ALIASES
+h4. Set up aliases
@git config --global alias.co checkout@
-h4. VIEW YOUR CONFIGURATION
+h4. View your configuration
@cat .gitconfig@
-h4. TO IGNORE WHITESPACE (Ruby is whitespace insensitive)
+h4. To ignore whitespace (Ruby is whitespace insensitive)
@git config --global apply.whitespace nowarn@
@@ -91,13 +91,13 @@ gl = git pull
gp = git push
gst = git status
-h3. START USING GIT
+h3. Start using git
@git init@
-h4. TO IGNORE SOME FILES
+h4. Ignoring files
-Add a file in the root directory called .gitignore and add some files to it: (comments begin with hash)
+Add a file in the root directory called @.gitignore@ and add some files to it: (comments begin with hash)
*.log
db/schema.rb
@@ -112,92 +112,92 @@ Then add an empty @.gitignore@ in the empty directory:
@touch log/.gitignore@
-h4. TO SCHEDULE THE ADDITION OF ALL FILES TO THE NEXT COMMIT
+h4. Scheduling the addition of all files to the next commit
@git add .@
-h4. TO SEE THE STATUS
+h4. Checking the status of your repository
@git status@
-h4. TO COMMIT
+h4. Committing files
@git commit -m "First import"@
-h4. TO SEE WHAT HAS BEEN COMMITTED
+h4. Seeing what files have been committed
@git ls-files@
-h4. TO SCHEDULE DELETION OF A FILE
+h4. Scheduling deletion of a file
@git rm [file name]@
-h4. TO COMMIT ALL CHANGES IN FILES IN THE CURRENT REPOSITORY
+h4. Committing all changes in a repository
@git commit -a@
-h4. TO SCHEDULE THE ADDITION OF AN INDIVIDUAL FILE TO THE NEXT COMMIT
+h4. Scheduling the addition of an individual file to the next commit
@git add [file name]@
-h4. TO VIEW THE DIFFERENCE AS YOU COMMIT USE THE -v OPTION
+h4. Viewing the difference as you commit
@git commit -v@
-h4. TO COMMIT AND TYPE THE MESSAGE ON THE COMMAND LINE USE THE -m OPTION
+h4. Commit and type the message on the command line
@git commit -m "This is the message describing the commit"@
-h4. TO COMMIT AND GET AUTOMATICALLY ANY CHANGES FROM OTHER PEOPLE USE THE -a OPTION
+h4. Commit and automatically get any other changes
@git commit -a@
-h4. THE NORMAL COMMIT COMMAND:
+h4. A "normal" commit command
@git commit -a -v@
-h4. TO VIEW A LOG OF YOUR COMMITS
+h4. Viewing a log of your commits
@git log@
-h4. TO VIEW A LOG OF YOUR COMMITS WITH A GRAPH TO SHOW THE EXTENT OF THE CHANGES
+h4. Viewing a log of your commits with a graph to show the changes
@git log --stat@
-h4. TO HAVE PAGINATION WHEN VIEWING THE LOG FILE USE THE -v OPTION
+h4. Viewing a log with pagination
@git log -v@
-h4. TO VISUALIZE YOUR CHANGES
+h4. Visualizing git changes
@gitk --all@
-h4. TO CREATE A NEW TAG AND PUSH IT ON THE REMOTE BRANCH
+h4. Creating a new tag and pushing it to the remote branch
@git tag "v1.3"@
@git push --tags@
-h4. TO CREATE A NEW BRANCH
+h4. Creating a new branch
@git branch [name of your new branch]@
-h4. TO PUSH THE NEW BRANCH TO A REMOTE REPOSITORY
+h4. Pushing the branch to a remote repository
@git push origin [new-remote]@
-h4. TO PULL A NEW BRANCH FROM A REMOTE REPOSITORY
+h4. Pulling a new branch from a remote repository
@git fetch origin [remote-branch]:[new-local-branch]@
-h4. TO VIEW ALL OF THE EXISTING BRANCHES
+h4. Viewing branches
@git branch@
-h4. TO VIEW A LIST OF ALL BRANCHES
+h4. Viewing a list of all existing branches
@git branch -a@
-h4. TO SWITCH TO ANOTHER BRANCH
+h4. Switching to another branch
The state of your file system will change after executing this command.
@@ -207,11 +207,11 @@ OR
@git co [name of the branch you want to switch to]@
-h4. TO MAKE SURE THAT YOUR NEW BRANCH GETS CHANGES FROM THE MASTER BRANCH (WHERE EVERYBODY ELSE IS WORKING) USE THE REBASE COMMAND
+h4. Making sure changes on master appear in your branch
@git rebase master@
-h4. TO MERGE YOUR NEW BRANCH INTO THE MASTER BRANCH
+h4. Merging a branch back into the master branch
First, switch back to the master branch:
@@ -225,23 +225,23 @@ If you're in a branch that's not the @xyz@ branch and want to merge the @xyz@ br
@git merge xyz@
-h4. TO REVERT YOUR CHANGES to before the merge.
+h4. Reverting changes to before said merge
@git reset --hard ORIG_HEAD@
-h4. TO RESOLVE CONFLICTS just edit your file.
+h4. Resolving conflicts
Remove the markings, add the file, then commit.
-h4. TO CREATE A BRANCH AND SWITCH TO THE BRANCH IN ONE MOVE:
+h4. Creating a branch (and switching to the new branch) in one line
@git checkout -b [name of new branch]@
-h4. TO CREATE A "CLIPBOARD" or "STASH" OF CHANGES THAT ARE NOT YET COMMITED (SO THAT YOU CAN SWITCH TO ANOTHER BRANCH IN THE MIDDLE OF YOUR CHANGES.), CREATE A STASH.
+h4. Creating a stash (like a clipboard) of changes to allow you to switch branches without committing
@git stash save "Put a message here to remind you of what you're saving to the clipboard"@
-h4. TO SWITCH AWAY FROM THE CURRENT BRANCH
+h4. Switching from the current branch to another
@git co [branch you want to switch to]@
@@ -250,29 +250,29 @@ Then switch back to the stashed branch
@git co [the stashed branch]@
-h4. TO VIEW THE LIST OF STASHES
+h4. Viewing a list of stashes
@git stash list@
-h4. TO LOAD BACK THE "CLIPBOARD" OR "STASH"
+h4. Loading back the stash
@git stash apply@
Now you can continue to work where you were previously.
-h4. TO DELETE A BRANCH THAT IS NOT USED ANYMORE, but already merged into the current branch. (TO CLEAN UP)
+h4. Deleting a branch (that has been merged back at some point)
@git branch -d [name of branch you want to delete]@
-h4. TO DELETE AN UNMERGED BRANCH
+h4. Deleting an unmerged branch
@git branch -D [name of branch you want to delete]@
-h4. TO DELETE THE STASH. (ERASE THE "CLIPBOARD" FROM MEMORY)
+h4. Deleting a stash
@git stash clear@
-h4. TO SET UP YOUR REPOSITORY FOR SHARING ON A CENTRAL SERVER
+h4. Setting up a repository for use on a remote server
Copy up your repository. e.g.:
@@ -286,52 +286,43 @@ On the repository server:
Then (for security) restrict the "deploy" user to doing git-related things in @/etc/passwd@ with a @git-shell@.
-h4. TO CHECK OUT THE GIT REPOSITORY TO YOUR LOCALHOST. ON YOUR LOCAL HOST DO THIS:
+h4. Checking out a git repository from a remote to your local storage
@git clone git@@@yourbox.com:/var/git/my_project@
-h4. TO SEE SOME INFO ABOUT THE REPOSITORY THAT WILL TELL YOU WHICH REPOSITORY IS THE MASTER AND WHICH IS THE SLAVE:
+h4. Viewing extra info about a remote repository
@cat .git/config@
By virtue of having cloned the remote repository, your local repository becomes the slave and will track and synchronize with the remote master branch.
-h4. TO UPDATE YOUR LOCAL BRANCH FROM THE REMOTE SERVER:
+h4. Updating a local branch from the remote server
@git pull@
-h4. TO GET A COPY OF THE ENTIRE REMOTE REPOSITORY (e.g. a repository named "laptop") WITHOUT MERGING THEM INTO YOUR LOCAL BRANCHES USE FETCH
+h4. Downloading a copy of an entire repository (e.g. @laptop@) without merging into your local branch
@git fetch laptop@
-h4. TO MERGE TWO LOCAL BRANCHES (ie. your local xyz branch with your local master branch) USE MERGE
+h4. Merging two local branches (ie. your local xyz branch with your local master branch) USE MERGE
@git merge laptop/xyz@
This merged the (already copied laptop repository's xyz branch) with the current branch you're sitting in.
-
-h4. TO MERGE THE REMOTE BRANCH WITH YOUR LOCAL BRANCH THAT YOU ARE SITTING IN USE PULL
-
-h4. TO ADD LOCAL KNOWLEDGE (TO YOUR LOCAL REPOSITORY) OF A 2ND REMOTE REPOSITORY, LIKE YOUR LAPTOP
-
-@git remote add laptop duo2book.local:repos/m_project@
-
-where '''laptop''" is the name of the remote repository and "''duo2book.local''" is the name of the remote machine.
-
-h4. TO VIEW META INFORMATION ABOUT THAT REMOTE REPOSITORY
+h4. Viewing metadata about a remote repository
@git remote show laptop@
-h4. TO PUSH A COMMITTED LOCAL CHANGE OF THE xyz BRANCH TO THE REMOTE laptop BRANCH
+h4. Pushing a committed local change from one local branch to another remote branch
@git push laptop xyz@
-h4. TO CREATE A TRACKING BRANCH (A SLAVE BRANCH). Ie. to link a local branch to a remote branch:
+h4. Creating a tracking branch (i.e. to link a local branch to a remote branch)
@git branch --track local_branch remote_branch@
-h4. NOW IF YOU'RE SITTING IN THE LOCAL TRACKING BRANCH, TO PULL YOU DON'T NEED TO SPECIFY THE REMOTE TRACKING BRANCH:
+You do not need to specify the local branch if you are already sitting in it.
@git pull@
@@ -339,22 +330,22 @@ Note: You can track(link) different local branches to different remote machines.
By convention, 'origin' is the local name given to the remote centralized server which is the way SVN is usually set up on a remote server.
-h4. TO SEE WHICH LOCAL BRANCHES ARE TRACKING A REMOTE BRANCH:
+h4. Seeing which local branches are tracking a remote branch
@git remote show origin@
-h4. TO WORK WITH AN SVN REPOSITORY BUT WORK WITH GIT LOCALLY:
+h4. Working with a remote Subversion repository (but with git locally)
@git-svn clone [http location of an svn repository]@
Now you can work with the checked out directory as though it was a git repository. (cuz it is)
-h4. TO PUSH (COMMIT) CHANGES TO THE REMOTE SERVER
+h4. Pushing (committing) changes to a remote Subversion repository
@git-svn dcommit@
-h4. TO UPDATE YOUR LOCAL REPOSITORY FROM THE SVN REPOSITORY
+h4. Updating a local git repository from a remote Subversion repository
@git-svn rebase@