Merge pull request #181 from laomaiweng/cheatsheets

Additional cheatsheets: rpm, hub
This commit is contained in:
Chris Lane 2014-08-11 21:34:12 -04:00
commit 28478ff257
3 changed files with 137 additions and 0 deletions

74
cheat/cheatsheets/hub Normal file
View File

@ -0,0 +1,74 @@
As a contributor to open-source
-------------------------------
# clone your own project
$ git clone dotfiles
→ git clone git://github.com/YOUR_USER/dotfiles.git
# clone another project
$ git clone github/hub
→ git clone git://github.com/github/hub.git
# see the current project's issues
$ git browse -- issues
→ open https://github.com/github/hub/issues
# open another project's wiki
$ git browse mojombo/jekyll wiki
→ open https://github.com/mojombo/jekyll/wiki
## Example workflow for contributing to a project:
$ git clone github/hub
$ cd hub
# create a topic branch
$ git checkout -b feature
→ ( making changes ... )
$ git commit -m "done with feature"
# It's time to fork the repo!
$ git fork
→ (forking repo on GitHub...)
→ git remote add YOUR_USER git://github.com/YOUR_USER/hub.git
# push the changes to your new remote
$ git push YOUR_USER feature
# open a pull request for the topic branch you've just pushed
$ git pull-request
→ (opens a text editor for your pull request message)
As an open-source maintainer
----------------------------
# fetch from multiple trusted forks, even if they don't yet exist as remotes
$ git fetch mislav,cehoffman
→ git remote add mislav git://github.com/mislav/hub.git
→ git remote add cehoffman git://github.com/cehoffman/hub.git
→ git fetch --multiple mislav cehoffman
# check out a pull request for review
$ git checkout https://github.com/github/hub/pull/134
→ (creates a new branch with the contents of the pull request)
# directly apply all commits from a pull request to the current branch
$ git am -3 https://github.com/github/hub/pull/134
# cherry-pick a GitHub URL
$ git cherry-pick https://github.com/xoebus/hub/commit/177eeb8
→ git remote add xoebus git://github.com/xoebus/hub.git
→ git fetch xoebus
→ git cherry-pick 177eeb8
# `am` can be better than cherry-pick since it doesn't create a remote
$ git am https://github.com/xoebus/hub/commit/177eeb8
# open the GitHub compare view between two releases
$ git compare v0.9..v1.0
# put compare URL for a topic branch to clipboard
$ git compare -u feature | pbcopy
# create a repo for a new project
$ git init
$ git add . && git commit -m "It begins."
$ git create -d "My new thing"
→ (creates a new project on GitHub with the name of current directory)
$ git push origin master

View File

@ -0,0 +1,49 @@
Moving around
Ctrl-b Move the cursor one character ⇦ to the left
Ctrl-f Move the cursor one character ⇨ to the right
Alt-b Move the cursor one word ⇦ to the left
Alt-f Move the cursor one word ⇨ to the right
Ctrl-a Move the cursor ⇤ to the start of the line
Ctrl-e Move the cursor ⇥ to the end of the line
Ctrl-x-x Move the cursor ⇤⇥ to the start, and to the end again
Cut, copy and paste
Backspace Delete the character ⇦ to the left of the cursor
DEL
Ctrl-d Delete the character underneath the cursor
Ctrl-u Delete everything ⇤ from the cursor back to the line start
Ctrl-k Delete everything ⇥ from the cursor to the end of the line
Alt-d Delete word ⇨ until before the next word boundary
Ctrl-w Delete word ⇦ until after the previous word boundary
Ctrl-y Yank/Paste prev. killed text at the cursor position
Alt-y Yank/Paste prev. prev. killed text at the cursor position
History
Ctrl-p Move in history one line ⇧ before this line
Ctrl-n Move in history one line ⇩ after this line
Alt-> Move in history all the lines ⇩ to the line currently being entered
Ctrl-r Incrementally search the line history ⇧ backwardly
Ctrl-s Incrementally search the line history ⇩ forwardly
Ctrl-J End an incremental search
Ctrl-G Abort an incremental search and restore the original line
Alt-Ctrl-y Yank/Paste arg. 1 of prev. cmnd at the cursor position
Alt-.
Alt-_ Yank/Paste last arg of prev. cmnd at the cursor position
Undo
Ctrl-_
Ctrl-x
Ctrl-u Undo the last editing command; you can undo all the way back to an empty line
Alt-r Undo all changes made to this line
Ctrl-l Clear the screen, reprinting the current line at the top
Ctrl-l Clear the screen, reprinting the current line at the top
Completion
TAB Auto-complete a name
Alt-/ Auto-complete a name (without smart completion)
Alt-? List the possible completions of the preceeding text
Alt-* Insert all possible completions of the preceeding text
Transpose
Ctrl-t Transpose/drag char. before the cursor ↷ over the character at the cursor
Alt-t Transpose/drag word before the cursor ↷ over the word at/after the cursor

14
cheat/cheatsheets/rpm Normal file
View File

@ -0,0 +1,14 @@
# To install a package:
rpm -ivh <rpm>
# To remove a package:
rpm -e <package>
# To find what package installs a file:
rpm -qf </path/to/file>
# To find what files are installed by a package:
rpm -qpl <rpm>
# To list all installed packages:
rpm -qa