2. INSTALLING GIT AND REQUIREMENTS Flashcards
GIT CONFIG COMMAND
You can use the Git Config command and set up the username as well as the user email. If you already have a GitHub account, you may want to use your GitHub email address here. So you’ll get credit on GitHub as well.
Ej:
git config –global user.name “[name]”
git config –global user.email “[email address]”
GLOBAL OPTION
The global option makes sure that every project in this computer will use the same name and email address.
GIT INIT COMMAND
This command is used to start a new repository.
usage: git init [repository name]
When you initialize Git, it creates an invisible folder called .git in the project folder. Now this is where Git stores all the information about the project.
¿Git Add command and Staging environment?
¿Git Add command and Staging environment?
In order to create an entry that we can go back to. We have to add the files to the staging environment. With the add command, staging is a temporary area that we can store files that we want to commit later on, you use the git add and then specified the file name that you want to move to staging.
GIT COMMIT COMMAND
This command records or snapshots the file permanently in the version history.
Usage: git commit -m “[ Type in the commit message]”
GIT LOG COMMAND
It helps me to verify that Git is keeping track of what we’ve done. You can see the entry that Git has made, which is being tracked.
Usage: git log
This command is used to list the version history for the current branch.
GIT ENVIROMENTS
- Working
- Staging
- Commit
FILE STATES
- Tracked (commit)
* Untracked (ex: a new file added since the last commit)
TRACK FILES STATES
- Unmodified
- Modified
- Staged
GIT STATUS COMMAND
Usage: git status
This command lists all the files that have to be committed.
GIT RESTORE COMMAND
Usage: git-restore
Restore working tree files
Issue a git restore command with the file name or use the period to restore your current directory. It’s definitely a lot shorter.
GIT CHECKOUT PERIOD COMMAND
git-checkout - Switch branches or restore working tree files
This command is an older version of the restore command that is still in use.
¿What is the period for at the commands?
It adds everything in the current directoryNow we’re back to where we were a minute ago.
¿What happens with untracked files and Git?
Git isn’t doing anything with untracked files. So if you want to get rid of notes, you would have to delete it manually.
Two of the most important things on Git
- How the different environments work as well as
- The file states and what each of them does.
This will make it easier to understand what is happening with your project as it gets more complicated.