• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/37

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

37 Cards in this Set

  • Front
  • Back
How to see current changes in working directory?
git diff
How to show full diffs in git log output?
git log -p
How to limit the number of log entries displayed?
e.g. git log -2
How to see which files were changed in each commit?
git log --stat
How to see just one line per log entry?
git log --pretty=oneline
How to revert a modified file?
e.g. git checkout -- foo.dat
How to show what remotes a repository has.
git remote -v
What is origin?
The remote your repository was cloned from.
How to add a remote with a short name?
git remote add [shortname] [url]
How to retrieve data from a remote repository (without changing anything in current working copy)?
git fetch [shortname]
How to retrieve and merge data into a tracking branch when current working directory contains the branch?
git pull
How to push data to remote server?
git push [server name] [branch name]
e.g. git push origin master
How to get info about a remote?
git remote show [remote name]
How to revert all changes in working directory?
git checkout -- .
How to view type of a git object?
git cat-file -t <object hash&gt
How to view contents of a git object?
git cat-file -p &ltobject hash&gt
How to create a new branch pointing to same commit as is current?
git branch <branch name>

(doesn't switch)
How does git keep track of which branch you're currently on?
.git/HEAD
How to create a new branch and switch to it?
git checkout -b <new branch name>
How to merge a branch into current working directory, with commit and without?
git merge <branch name>

git merge <branch name> --no-commit

How to delete a branch?
git branch -d <branch name>
(only works for branches that have been merged)
How to pick up recent changes from master into current branch?
git merge master
How to delete a branch that hasn't been merged?
git branch -D <branch name>
How to get git to ignore emacs temp files?
Create file .gitexcludes that contains single line:

.#*

Add line to [core] section of ~/.gitconfig file:

excludesfile = /home/george/.gitexcludes
How to delete last commit?
git reset --soft HEAD~1

(http://nakkaya.com/2009/09/24/git-delete-last-commit/)
How to rename a branch?
git branch -m <oldname> <newname>
What is a remote branch?
A reference to a branch on a remote repository. They get moved automatically when you do network communication.
What's the form of a remote branch?
&lt;remote name&gt;/&lt;branch name&gt;
How to create a tracking branch?
git checkout -b &lt;branch name&gt; &lt;server name&gt;/&lt;branch name&gt;

or

git branch --track &lt;server-name&gt;/&lt;branch name&gt;
How to delete a branch on a remote server after deleting it locally?
git push &lt;server name&gt; :&lt;branch name&gt;
How to cancel an unfinished merge?
git reset --merge ORIG_HEAD
How to edit last commit message?
git commit --amend
What is a bare repository?
A repository without a working directory, as typically used by a git server. (Basically, it's just the project's .git directory tree.)
How to omit merges from git log?
git log --no-merges
How to create a new local branch from upstream/master?
git checkout -b branch-name upstream/master (fetch upstream first)
How to push a rebased branch?
git push -f origin branch-name
What does merge --squash do?
Takes all the work on the merged branch and squashes it into one non-merge commit on top of the branch you’re on. (Use --no-commit to prevent committing it to branch, so you can add additional changes and commit it all together.)