-
Notifications
You must be signed in to change notification settings - Fork 0
Git & Github
Documentation on how to handle branches, pull requests, code reviews along with git commands
Clone a repository
$ git clone https://github.com/LynxMasters/base.gitMake your own work branch follow this naming convention
$ git checkout -b "ian/facebook-api-calls"After you're done with your work follow these steps
$ git status # displays state of working directory
$ git add <filename> # to add individual files
# or
$ git add . # adds all files in working directoryNext commit the changes you've made to your local branch
$ git commit -m "added new fetch call to pull profile friends" Now lets make sure there haven't been any updates to Master branch
$ git checkout master # this switches you back to master branch
$ git fetch # this will fetch any changes from master
# If there are changes you should get a message along these lines
On branch Master
Your branch is behind 'origin/master' by 2 commits
Use "git pull" to update your local branch
$ git pull # pull any changes made since last fetch/mergeIt should display all files that have been changes since last pull
Now lets checkout your working branch and merge the changes you just pulled
$ git checkout -b "ian/facebook-api-calls" # checkout your work branch
$ git merge master # this will merge your work branch with masterIf you have any merge conflicts resolve them See How here
Next push your changes to it's own remote branch
$ git push --set-upstream origin ian/facebook-api-calls # this creates a remote branch on githubUse git stash and git stash pop
Check status of your working branch
$ git statusIf you have untracked files that need to be commit but want to pull changes from master
$ git stash # this will stash your untracked files and revert HEAD commit
# run 'git status' to see your local changes are stashed away**Checkout master and pull any changes **
$ git checkout master
$ git pull
$ git checkout <name/your-branch>Re-applying your stashed changes
$ git stash pop # this will reapply stashed changes to local directory$ git status # you will now see your changes
$ git add .
$ git pushTODO