part3 Git Flashcards
what is git?
Git is a tool that helps you track changes in your files over time
what is the meaning of version control system ?
version control system means we can go back in time and work with a different version of our code base.
what is the difference between a local and a remote repository in git?
Local repository: This is the copy of your project that resides on your own computer. You work directly with files here, make changes, commit them (save snapshots), and manage versions locally.
Remote repository: This is a version of your project that is stored on a server, like GitHub or GitLab. It acts as a central hub where you can share your changes with others, collaborate on projects, and synchronize your work across multiple computers.
what are the three stages of the local repository?
Working Directory: This is where you modify files for your project.
Staging Area : contain new changes that will soon be committed.
Committed files: This is where Git permanently stores the committed changes as snapshots in the .git directory. Changes here are tracked and can be accessed or reverted as needed.
what are untracked files?
Untracked files in Git are files that Git is not currently keeping track of. These are typically new files that you’ve created in your project directory but haven’t yet told Git to start monitoring.
What command do you run to put your files in a staging area?
git add [file name]
what does the git restore command do?
It effectively reverts changes made to files, either by replacing them with the last committed version or by unstaging changes that have been added to the staging area.
what is the command to remove a file from the staging area?
git restore - -staged [file name]
what is a .gitignorefile?
A .gitignore file is a text file used by Git to specify which files and directories should be ignored and not tracked by Git
what does the command git log do?
The git log command displays a history of commits in a Git repository. Git shows you a list of commits starting from the most recent to the oldest when you run this command.
what is a branch in git?
It allows you to work on different versions of your project simultaneously without affecting the main codebase.
what is the default git branch ?
master/main
what is the command to create a new branch ?
what is the command to switch to another branch ?
command to create a branch and immediately switch to the branch?
command to delete a branch ?
git branch [branch name]
git checkout [branch name]
git checkout -b [branch name]
git branch -d [branch name]
what is the command to see a list of all available branches?
git branch
what are some of the platforms that can host a remote repository?
- GitHub Gitlab Bitbucket and many more