This is just stuff that I have put down that I find I use a lot of the time for my own reference.
$ git branch shows what branch you're on
$ git branch -r shows remote branches
$ git branch -a shows all branches
Create a PR Pull Request
Fork other users repo in GitHub, then clone to your machine.
$ git clone https://github.com/YourUserName/awesome-awesome-repo
Add the remote repo
$ git remote add upstream https://github.com/OtherUserName/awesome-awesome-repo
Create your branch
$ git branch your-awesome-branch
Check it out
$ git checkout your-awesome-branch
If adding a folder use.
$ git add nameOfFolder/\\*
Make your commit and push to your new branch.
$ git commit -m 'initial commit'
$ git push origin your-awesome-branch
Manage the rest of the PR via GitHub
git remote -v
First configure the local to point to the remote upstream
$ git remote -v
$ git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
$ git remote -v
$ git fetch upstream
$ git checkout master
$ git merge upstream/master
You then use git merge to update any branch on the upstream repository:
$ git merge upstream/dev
Using two factor autentication? Then use the following so you're not addin in your auth token each time you want to push your code.
git remote set-url origin https://yourgithubuser:[email protected]/yourgithubuser/yourrepo.git
Via terminal navigate to your code folder.
$ git init
Add your files.
$ git add .
Adding a folder use the following syntax or it'll get added as a BLOB.
$ git add nameOfFolder/\\*
Commit to local repo.
git commit -m 'some detailed message'
To add your files to the remote repo, first add your remote repo
$ git remote add origin [remote repository URL]
# Sets the new remote
$ git remote -v
# Verifies the new remote URL
$ git push origin master
If you have .env files that are tracked by Git and want to ignore them so your API keys dont get added to GitHubm use:
$ git update-index --assume-unchanged <file>