Keep your repo up to date
-
git clone- creates a local copy of the repository for you to work ingit clone https://github.com/username/pan.dev.gitUse this when you have not yet created a copy of the repo locally
-
git pullpulls changes from repository you cloned and merges them into their respective branchesgit pullUse this when you want to grab changes that have been pushed to the repo you are working on and bring them locally
-
git fetchreaches out to repository you cloned to ask if there are changes, does not merge themgit fetchUse this to see if if there are changes without merging them
-
git mergemergesbranch-nameinto your working branchgit merge `branch-name`Use this to get your repo in sync with another branch.
caution this could result in a conflict, more on that later
Keep track of your work
-
git checkoutcheckout a branch or create a new branch and check it outgit checkout -b branch-nameUse this to switch branches or create a new branch off of your current branch
-
git branchsee which branch you are working in and other available branchesgit branchUse this to keep track of where you are and which branches you have locally
-
git statussee all files with changes you've made in your working branchgit statusUse this to see what changes have been made (whether on purpose or accident)
-
git add <filename>adds a file you've edited to be staged for a commitgit add docs/contributing/git_basicsUse
git statusto see which files have changed andgit addto pull out only the files you want to commit.git add .will add all changed files.git committakes all staged files and bundles them into a commit
git commit -m "summary of the commit"Use this to combine your changes and prepare to push for others
-
git pushtakes a commit and pushes it to the repositorygit push origin branch-nameUse this to push the changes to the repository where you can share them with others or merge them into the main branch