Background
Quick Reminder on why not to quickly take pointers.
Git Sessions
Outline
- Session – 01
- git add
- git add .
- git commit
- git reset
- git add
- Session – 02
- git add
- git add <filename>
- git status
- git commit
- git push
- git add
Session – 01
git add
Issued “git add .”
git commit
Issued git commit.
My editor of choice launched and all of the files in my working folder and sub-directories were listed.
Seemingly issuing “git add .” means to add all files.
git reset
Issued “git reset” to discard all the files staged for local commit.
Session – 02
git add <filename>
Issued “git add <filename>“.
The filename is the name of the file to commit.
git status
Issued “git status” to review the list of files that will be “locally” committed.
Output
Output – Text
>git status On branch master Your branch is up to date with 'origin/master'. Changes to be committed: (use "git restore --staged <file>..." to unstage) modified: file01.sql
Output – Image
git commit
Issued git commit.
Once again, reviewed the list of files that will be committed.
Thankfully, this time, only the lone file.
Added a verbose commit message to indicate this is an important change.
git push
Issued git push to commit remotely.
Summary
Please be mindful that “git add .” implies adding all files in the current working folder, as well as subfolders.
If you prefer you can also consider using a gitignore file to expressly ignore specific folders and files.
Hopefully, you are not using your git repository as a backup folder.
References
- Git-SCM
- gitignore
Link
- gitignore