Skip to content

Instantly share code, notes, and snippets.

@huberflores
Last active December 2, 2015 15:41
Show Gist options
  • Save huberflores/8bb22d76cf4ef0642357 to your computer and use it in GitHub Desktop.
Save huberflores/8bb22d76cf4ef0642357 to your computer and use it in GitHub Desktop.
GitHub quick and short tutorial
#
# author Huber Flores
#
# 1) Basic commands
$ cd yourrepo/
#file that contains instructions, licenses, etc.
$ touch README.md
#Initialize repository, .git folder is created within "yourrepo/ "
$ git init
#Add the files to synchronize
$ git add README.md
#Assign a GitHub repository to "yourrepo/"
$ git remote add origin https://github.com/huberflores/Gyroscope-Accelerometer.git
#Generally, it's a good idea to update repository before committing. This will allow you to avoid version conflicts
$ git pull origin
#Commit to local repository
$ git commit -m "instructions"
#Commit to GitHub
$ git push -u origin master
# 2) Some other useful combinations
#To update a modified file
$ git add TouchGyroscope/src/mcm/accelerometer/gyroscope/DrawView.java
$ git commit -m "Redrawing test"
$ git push -u origin master
#To synchronize local repository with GitHub (Always before to commit)
$ git pull origin
#Repository already existed in github
$ git init
$ git remote add origin https://github.com/huberflores/ThesisLatexTemplate.git
$ git pull origin master
#Remove folder
$ git rm -r vendor/plugins
$ git commit -m "Your comment here"
$ git push -u origin master
#To check which files have been modified
$ git diff
$ git status
$ git add ...
$ git commit ...
#In case a "git add" command is added by mistake
$ git reset
$ git status
#In case a file is changed, but the changes want to be discarded, such that the file is the one in the remote repository
$ git checkout -f file.java
#Why are my contributions not showing up on my profile?
$ git config user.email
# kyoraul@gmail.com #This should appear, if not then
# Add your e-mail information to the working repository
$ git config --global user.email "kyoraul@gmail.com"
then, try again
$ git config user.email
# kyoraul@gmail.com #This should appear, if not then
Once you commit some work, then, the contributions will appear in the respective section.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment