25.10 Workflow commands
The following are common commands to perform the previously discussed workflow in a terminal.
git
has many commands, each having multiple options to modify behavior.- Want to know more, check out the Pro Git book.
25.10.1 Get Remote Repo/Update Local Repo
git clone <repo url>
(only needs to be run once*): pulls files into a directory (file)git pull
: retrieves changes from the remote repo
25.10.2 View info about local files
git branch
: see what branch you are on locally.git status
: see what files have changed locally.git diff
: see specific changes in the files.
25.10.3 Stage and document changes
git checkout <branch name>
: change your branch if needed.git add <file name>
: stage the file for documentation.git add -i
: interactive module for staging. Great for when you have lots of files to commit.git commit
: opens text editor to document changes.- If
vim
opens: Pressi
(insert) >> add your subject line >> draft your message >>Esc
>>:+x
>>Enter
.
- If
git commit -m <message>
: Short version for drafting commit messages.