Skip to content

GitHub Basics

Matthew Green edited this page Sep 10, 2018 · 1 revision

How to:

  1. Determine if git is installed git --version

  2. Determine git user git config user.name

  3. Determine git user email git config user.email

  4. Set user name git config user.name "Your Name"

  5. Set user email git config user.email "your@email.com"

  6. Create a repository (folder for an) git init repository_name

git add -> copies files from working directory to staging area

git commit -> copies files from staging area to Repository

  1. Check for commits git status

  2. check changes since last commit git diff

  3. Check changes since last add get diff --staged

  4. Take a file out of staging and back to working git reset file.txt

  5. View git history within a local repository git log

== "Adding a remote allows you to transfer your commits to another machine"

  1. Check to see if there is a remote location set-up for a local repository. git remote

  2. Add a remote repository for a local repository. git remote add origin http://xxgitxx.com/xxxxxx

  3. Push contents of local to remote git push origin master

  4. Copy files from repository to local git fetch

  5. View all branches. tree .git/refs

  6. Establish connection to remote repo (Bookmark) git remote add origin (REPO Location) Origin is the name of the remote connection - for latter use (defined by this command - user defined)

  7. To determine if there is a remote connection to repository git remote

  8. Push branch to repo git push origin master (mater is the default branch)

  9. Bookmarking the connection git push -u origin master After that git push will push master

  10. List bookmarks git remotes -v (verbose)

  11. Retrieve files from GitHub fetch

  12. Merge issues #fetching remote 'feature/my_feature_branch' branch to the 'tmp' local branch git fetch origin feature/my_feature_branch:tmp

#rebasing on local 'tmp' branch git rebase tmp

#pushing local changes to the remote git push origin HEAD:feature/my_feature_branch

#removing temporary created 'tmp' branch git branch -D tmp

Clone this wiki locally