Git and GitHub Flashcards
What does Git do?
It tracks the changes you make to files (AKA a version control system).
*you have a record of what has been done
*you can revert to specific versions
*allows changes by multiple people to all be merged into one source.
Three basic Git commands
*git init (this creates or initializes an empty git repository)
*git add xxxx adds file to the staging area. Use a . to add all files.
*git commit -m ‘x’ where x = a description of your update
What’s the Git command for looking at your version history?
git log
*This shows a repository’s history, i.e. all previous saved changes
*use when you need to find a specific version of a project
*use to figure out what changes will be introduced by merging in a feature branch.
What’s the git command for going into a previous version of your code?
git checkout x
(where x is the code from git log. This code is a ‘commit hash’)
What’s the difference between Git and Github?
Git is stored on your computer. Github is a website where you can put a git so other people can access it.
What is a repository in Git?
Another name for a folder. Nothing more.
What is a commit in Git?
*a snapshot or milestone along the timeline of a Git project.
*the core building block unit of a Git project timeline.
*created with the git commit command to capture the state of a project at that point in time.
What is a branch in Git?
an independent line of development. You have the option of merging them into the master branch or not merging them
What’s it called when you publish from your Git to GitHub?
a push. The command is:
git push origin master
or
git push origin new-branch (for publishing changes after the original is already changed?)
What’s it called when you download from GitHub to your local Git?
a pull. The command is –git pull origin master– to pull the whole thing
How do you create a branch in Git?
git checkout -b new branch
How do you check the status of new changes in Git?
git status