Commands Flashcards
Configure your username and email
git config –global user.name “Your name”
git config –global user.email “yourname@provider.com”
View git configurations
git config –list
How to initialize a repository
Create a folder and repository on GitHub and open the folder in the Terminal and use the command “git init”
instruct Git to link it with the remote repository
git remote add origin repo-url
If your remote repository already contains some code files, then you need to pull them inside your local repository
git pull
git init + git remote add origin repo-url + git pull
git clone repo-url [folder]
verify if a local repository is tracking the remote repository
git remote -v
replace the remote url
git remote set-url origin repo-url
This file contains files and folder names that should be ignored by Git while making commits.
.gitignore
move these files to the staging area
git add . || git add [filename] || git add -A || git add *
If you added some files in the staging area by mistake, then you can use the following command to unstage them
git reset [filename]
To create a commit, use the following command.
git commit -m “initial commit”
flag is used to insert a message that will describe the commit.
-m
All files shows _____ mode which means there are all new file.
create
To see all the commits in the repository (made by all the developers), use following command.
git log