- Initilize git using
git init
once you are in the working directory you would like git to track - Git is now tracking the working directory
- at any point you can use
git status
to check the status of the files in your directory - If a file is added to the directory then it will initially be untracked
- add file to staging area via
git add <file>
- commit file to finalize addition via
git commit -m '<insert text>'
- once you run
git status
it should say "nothing to commit, working tree clean" - Any time a file is modified or created then you will need to repeat the
git add
andgit commit
commands to finalize those modifications
- For the first commit made always make the text 'Initial commit'
- you can use
git diff <filename>
before changes are added to see what changes have been made - you can use
git log --format=oneline
to see a log of each commit on one line
johnadams~/git_and_gh_practice$ git commit -m 'Initial commit'
[master (root-commit) bd60f9a] Initial commit
Committer: John Adams <[email protected]>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:
git config --global --edit
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
2 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 hobbies.txt
create mode 100644 travels.txt
You can get the status of your files and work within git by using the command git status
and it will look something like this johnadams~/git_and_gh_practice$ git status