Git/ Github Flashcards
What is a repository?
A central location where the project is being kept and where changes will be tracked.
In programming: What is a trunk?
The master branch of our project in the repository. The most stable and recent versions of our project resides.
In programming: What is the term ‘Staging a file’ mean?
Telling the source control system about the files within the repository we create.
In programming: What is the term ‘commit’?
A snapshot of your program
In programming: What does creating a new branch mean?
Branching away from the master branch so we can work on a new feature or bug fix without the risk of breaking something in our master branch.
Terminal: git status
list which (unstaged) filed have changed
Terminal: git diff
list (unstaged) changes to files
Terminal: git log
list recent commits
Terminal: git add fn
stage file
Terminal: git commit -m ‘message’
commit file
Terminal: git commit -am ‘message’
add/commit all changes from all tracked file (no untracked files) in one go.
Terminal: git reset filename
unstage file
Terminal: commit –amend -m ‘message’
alter the last commit (add any staged files, new comment)
Terminal: git reset –soft HEAD^
undo previous commit, put changes in staging
Terminal: git reset –hard HEAD^
Undo last commit and all changes
Terminal: git reset –hard HEAD^^
Undo two (^^) last commits and all changes
Terminal: git checkout – cats.html index.html
Undo all changes that were made to files cats.html and index.html
Terminal: git rebase –onto \^ HEAD
remove specific commit from repository. the \ in ^ is just an escape char to make zsh play nice and is not necessary if using bash.