Git Flashcards
Create, use, and explore file repositories (39 cards)
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
Reset working files and staged files to the branch named ‘topic’
Committed»_space;> Staged»_space;> Workspace
git checkout topic
Reset working file and staged file to committed file in branch named ‘topic’
Committed»_space;> Staged»_space;> Workspace
git checkout topic file
Undo file changes committed in the commit that starts with ‘123456’
git revert 123456
List all committed branches
git branch
List all committed branches and all remote repository branches
git branch –all
Create a new branch called ‘topic’ in the committed files starting at the current commit
git branch topic
Reset staged files to committed files at the commit that starts with 123456
Committed»_space;> Staged
git reset 123456
Reset working files and staged files to committed files at the commit that starts with 123456
Committed»_space;> Staged»_space;> Workspace
git reset –hard 123456
Apply current changes to the branch named ‘topic’ in the committed files and move to the new commit
Committed»_space;> Staged»_space;> Workspace
git rebase topic