Git Flashcards
1.What does git remote add origin do? 2.Why is this important?
1.It adds a remote server that we back our code up onto when we run git push.
2. Important because we want a back up of the code in case our local system explodes.
1.What is the difference between commit and an add? 2.Why do you do one or the other?
- Add: when we tell git which file we’re ready to put in a commit. It happens first.
- Commit: we store a snapshot of the added code and directory structure to git, when we’re ready to record the changes we made.
What is a timeline?(name pointers that are important in the timeline)
Timeline is many commits. It represents how the files change over time.
-Head: the commit your system is currently emulating
-Branch(main): the most recent commit
What does git init do?
Git init initialized a file structure.
Running git init connects a folder to git.
When you hook up a folder to git init, it adds a dot-file containing the snapshots of your code and makes the system come together.
What does git add do?
Git add makes a copy of the file in staging.
-For things that are getting ready(staged) for changes
-Each added file is identified by a hash which is calculated from its contents.
-Different file contents = different hash
What does git commit do?
Git commit stores these objects in small file system managed by git.
-committing means putting the blobs together into a large objects called commits
- commits keep larger snapshots of the code base such as directory structure.
What does “~” mean?
Home
What is the default branch name ?
Main
What does git status do?
Tells us what’s going on in a folder.
What does pushing do to a local repository?
Push syncs (or copies) a local repository to a remote one.
What does pulling do in the remote repository?
Pull sync your local repository with a remote repository. It copies the files over and the directory structure.
What does cloning do?
Downloads the entire timeline to go towards the local repository.
What does checkout let us do when navigating the commit history with your HEAD.
Checkouts lets us move around in the timeline.
True or false?Whatever HEAD points to, The files on the system won’t be identical to those commit.
False. They are identical to those commit.
Why do we create many branches in a local repository?
To organize changes