Using GIT with Github
How to pull files from Github to local
- Install Git locally
- Start Git Bash
- cd to project folder
git init Initializes a local git repository (current location will be root)
git config --global user.email "youremail@email.com" Give youself an identity
git config --global user.name "Name"
git remote add origin https://github.com/JackWitek/*** Set github location
git pull origin master
Github code will now be in your local project folder
How to push files from local to Github
- Start git in project folder
git init Initializes a local git repository (current location will be root)
- Create a test file in new local repository location
git statusChecks for changes
git add [filename]Add one file to the staging environment
git add -A Add all files to staging environment
git commit -m "Test commit"Commit with comment
git push origin master Push to master
Local project folder contents will now be on github
Create seperate branch (For testing purposes, you shouldn't use master)
git branch List branches
git branch branchTestCreate a branch, won't switch to it
git checkout branchTestCreate/switch to branch locally (this will update local files)
git push origin branchTest Push branch to github
Branch is created/updated on github
git add -A Add all files to staging environment
git commit -m "Test commit"Commit with comment
git push origin brachTest Push to branch
Local code is moved to branch but not master
Notes
git branch -d [branch] Delete branch
ESC :wq To exit editor
git pull origin master --allow-unrelated-histories If pull is giving errors