Configuration Commands-Git
Configuration Commands-Git
pwd
General Syntax:
cat ~/.gitconfig
Starting Commands
pwd
Change Directory
cd folder-name
Git initialization
Command Reference
List
ls
Lists files and folders in current directory. Without parameters, will list non-hidden folders
and files.
Git Status
git status
Shows which files have been modified in the working directory vs Git's staging area.
Git Add
Git Commit
Commits all files currently in Git's staging area. The -m parameter allows for a commit
message directly from the command line.
Clear!
clear
Clears all previous commands from the terminal screen -- just a bit of clean up.
git status
git commit -am "Adding more ipsum"
git status
git status
git add index.html
git status
git status
clear
git status
git add README.md
git status
git commit -m "A few changes for the website"
clear
git status
git add .
git status
git commit -m "A few more changes for website"
clear
git status
git add README.md
git status
git reset HEAD README.md
clear
git status
git checkout -- README.md
git status
Command Reference
git add .
The period parameter for the git add command will recursively add all new and newly
modified files.
Unstage File
Following the above command will "unstage" the specified file from Git's staging area (aka
index).
ls
git add info.log
git commit -m "adding info log"
git status
clear
ls
rm info.log
ls
git status
git add .
git add -u
clear
git status
git commit -m "Removing info.log"
ls
git status
git status
ls -a
git add .gitignore
clear
git status
git commit -m "adding ignore file"
Command Reference
git log
git log --oneline --graph --decorate --color
Git's log command displays the repository's history in reverse chronological order. The no-
params version displays the standard view.
Git log options from above: --oneline Compacts log data on to one line, abbreviating the
SHA1 hash --graph Adds asterisk marks and pipes next to each commit to show the
branching graph lines --decorate Adds the markers for branch names and tags next to
corresponding commits --color Adds some color to the output -- nice to have, depending on
the operating system
git rm file-name
rm file-name
git add -u
The -u parameter will recursively update Git's staging area regarding deleted/moved files
outside of Git.
mkdir folder-name
The mkdir command is a nearly universal command for creating a directory/folder.
Making a directory (folder)
ssh -T [email protected]
Command Reference
ssh -T [email protected]
Above command uses ssh to connect to GitHub over the SSH protocol.
Command Reference
git remote -v
The git remote command lists the names of all the remote repositories and the -v parameter
(verbose) will display the full URL of the remote repository for each remote name listed