Help! I'm randomly typing git commands into the terminal.
Ok Ok...lets chill and take a systematic approach to this.
pwd
print working directory
ls -a
lists all files and folders in this directory. -a
sands for all (to display hidden folders too).
You should see a folder called .git
. If you don't, you may need to
- Go to a differnt folder
- Clone (download) the repository you're looking to work in from GitHub
- Init - turn the folder you're in into a new git repository
git branch
will show you which branch you're ongit log
will show your your commit log in that branch.
You can use the ↑ and ↓ arrows to look through your commit log.
Press q to quit.
-
git status
will show you your staging areaRead all the output messages thoroughly.
Take a few breaths and make a mental picture of what's going on.
- What was your last commit?
- Is your staging area empty?
- Is your local repository in sync with GitHub?
Tell yourself what needs to be done next before typing any commands:
- Do I need to add things to the staging area?
- Do I need to commit staged changes to the commit log?
- Do I need to push to github?
- Do I need to reach out for help?