Git Flashcards
Create, use, and explore file repositories
Create a local repository folder from the remote repository at ‘https://me.github.com/myrepo’
Repo»_space;> Commits»_space;> Staged»_space;> Workspace
git clone https://me.github.com/myrepo
Create a folder named ‘project’ with an empty local repository
Commits»_space;> Staged»_space;> Workspace
git init project
Link all local commits to the ‘origin’ branch of the remote repository at ‘https://me.github.com/myrepo’
git remote add origin https://me.github.com/myrepo
List staged, modified, and untracked files
Workspace Staged Committed
git status
Show differences between modified files and staged files
Workspace Staged
git diff
Show differences between staged files and committed files
Staged Committed
git diff –cached
Show differences between the committed branches ‘topic1’ and ‘topic2’
git diff topic1 topic2
Move a file named ‘file’ to the staged files
Workspace»_space;> Staged
git add file
Commit all staged files with the note ‘Because’
Staged»_space;> Committed
git commit -m “Because”
Add to previous commit by committing all staged files and replacing the note with ‘Because’
Staged»_space;> Committed
git commit –amend -m “Because”
Apply changes made on a branch named ‘topic’ to the current commit to create a new commit
Committed»_space;> Staged»_space;> Workspace
git merge topic
Rewrite committed history up to but not including the commit that starts with 123456
Committed»_space;> Staged»_space;> Workspace
git rebase –interactive 123456
Upload commits to the remote repository
Committed»_space;> Repo
git push
Remove the file named ‘file’ from the staged files
git rm –cached file
Remove all staged files
Committed»_space;> Staged
git reset HEAD