-
set a name that is identifiable for credit when receivew history
git config --global user.name "[firstname]" -
set and email , associated with each history maker
git config --global user.email "[valid email]"
Configuring user information used across all local repositories
-
initialize an existing directory and git repository
git init -
download an entire git repository into local machine
git clone [repository url]
-
show modified files in working directory
git status -
add files to next commit
git add [files] -
unstage all files while retaining the changes in working directory
git reset [file] -
diff of what is changed but not staged
git diff -
commit your staged content as a new commit snapshot
git commit -m "commit message"
- list your branches
git branch - create a new branch at the current commit
git branch [branch-name] - switch to another branch and check it out into your working directory
git checkout [branch name] - merge the specified branch’s history into the current one
git merge [branch] - show all commits in the current branch’s history
git log
- show the commit history for the currently active branch
git log - show the commits on branchA that are not on branchB
git log branchB..branchA - show the commits that changed file, even across renames
git log --follow [file]
- add a git URL as an alias
git remote add [alias][url] - fetch down all the branches from that Git remote
git fetch [alias] - merge a remote branch into your current branch to bring it up to date
git merge [alias]/[branch] - Transmit local branch commits to the remote repository branch
git push [alis] [branch] - fetch and merge any commits from the tracking remote branch
git pull
- apply any commits of current branch ahead of specified one
git rebase [branch] - clear staging area, rewrite working tree from specified commit
git reset --hard [commit]
- save modified and staged changes
git stash - list stack-order of stashed file chages
git stash list - write working from top of stash stack
git stash pop - discard the changes from top of stash stack
git stash drop