
User name
Set a name for credit when review version history.
git config –global user.name “Jane Smith”
User email
Set an email that will be associated with each history marker.
git config –global user.email “abc@example.com”
On macOS and Linux
git config –global core.autocrlf input
On Windows
git config –global core.autocrlf true
Text editor
git config –global core.editor “nano -w”
Default Branch name
git config –global init.defaultBranch main
Credential storage
git config –global credential.helper store
View the configurations
git config –list
un-report directoryTo check if you are there, print the working directory
pwd
Or you can list the files in the current directory
ls
git status
At this point, we will see an error message.
fatal: not a git repository
git init
git status
Git stores all project info inside a hidden .git folder
List all files
ls -a
List the files inside the .git folder
ls .git
An intermediate area where a subset of the modified files can be grouped for a commit.
It helps to split up unrelated changes in your working directory into multiple, meaningful commits.
git add [file_1] [file_2]
Add the files (as they look now) to the staging area for your next commit.
Commit: take a snapshot of the changes from the staged files
git commit -m “Initial commit”
Let’s create a file called README.md.
nano README.md
Let’s type some text into the README.md file
We can verify the file was indeed created by running
ls
We can also view the content of the file in the command line window by running
cat README.md
git status
git add README.md
git status
git commit -m “Start notes on analysis”
git status
nano README.md
Let’s add a second line into the README.md file
cat README.md
git status
git diff
git add README.md
git commit -m “Add information on points”
git status
Follow the previous examples to
README.md file## Notes for UN Report
We plotted life expectancy over time.
Each point represents a country.
Continents are grouped by color.Which of the following commit messages would be most appropriate for the last commit?
Source: https://xkcd.com/1296/
git log
git log -5
git log –oneline
un-report
README file.gitignore fileLICENSE fileun-report.gitgit remote add [alias] [the url you just copied]
By convention the GitHub repo is often named origin.
git remote add origin https://github.com/x/abc.git
Click your GitHub profile, then “Settings”.
Click “Developer settings” at bottom of the left panel.
Click “Token (classic)”.
git push origin main
git pull origin main