** Please do not change the database from sqlite3 in dev/test.**
(originally part of PHP repo: https://github.com/grayghostvisuals/Practice-Git)
My References:
Welcome to my practice git repository where you can change up as much as you'd like plus work with a real, living, breathing person on the other side. Here we learn all things git. Feel free to send me Pull Requests just to discover what it's like when a Repo Maintainer asks you.
and you're all like...
This is where we make those mistakes ... so don't be scared :)
##Instructions (Contributing)
Fork this repo and send me a Pull Request with anything from Grandma Peggy's Crumbled Oatmeal Cookie Recipe to your favorite Sublime Text 2 preferences. It's all good yo! Learning is the prize in this game.
git clone [email protected]:<user_name>/the-repo-you-are-cloning.git
git fetch upstream
git merge upstream/main
git add <file>
git status
and git diff
git status -s
git commit -m 'the message goes here for the commit'
git add '*.<file_extension>'
git rm --cached <file>
git log
git log --summary
git remote add origin [email protected]:<user_name>/<repo_name>.git
git remote -v
git reset <file>
git branch -r
git remote prune origin
git checkout <target>
git rebase
##Adding
git add <list of files>
(i.e. git add read me.md license.txt. Can be multiples)
git add --all
Add all the new files since last
git add *.txt
Add all txt files in directory
##Staging
git diff
Show unstated differences since last commit
git diff --staged
Gets the staged differences and doisplays what has changed since our last commit
##Reverting
git reset HEAD <file>
Head is the last commit on the current branch we are on. What if you stage something you didn't need to be staged? This is the key
git checkout -- <file>
Blow away all changes to a file since last commit
git reset --soft HEAD^
What if you regret commit? This will undo your last commit. (^ means move commit before HEAD and puts changes into staging).
git reset --hard HEAD
Undo Last commit and all changes
git commit --amend -m "added another file to the commit'
New commit message will override previous commit message
##Remotes "Remotes are kinda like bookmarks"
git remote -v
Show the current remote repos
git remote add <name> <address>
Add a new remote repo
git remote rm <name>
Remove remote repo
##Cloning, Branching, Fetching & Merging
git fetch
Pulls down any changes but doesn't merge them
git branch <branch name>
Makes a new branch
git checkout <branch name>
Switching branch and on a different timeline
git merge <branch>
Merges branch into main
git branch -d <branch name>
Deletes branch
git checkout -b <branch name>
Creates a new branch and then switches to it
VI Editor Quick Key Exit
:wq + enter
##Pushing & Pulling
git push -u origin main (remote repo name, local branch name) -u
Lets you just run git push later on without specifying name and branch
git pull
Pull changes in and syncs up your repo
git pull
Fetches or syncs local with remote repo. Doesn't update local code
##Branching
git branch -r
List all remote branches
git remote show origin
Show all the remote branches
git push origin :<branch name>
Deletes the remote branch
git branch -D <branch name>
Delete the local repo branch and if you don't want the commits any longer on it then delete them too.
git remote prune origin
Deletes the branch locally if it has been removed remotely. Helps to remove stale references.
##Rebasing "Merge commits are bad"
git rebase
Move all changes to main local which are not in origin/main remote to a temporary area
##History
git log
Viewing the commits history
git config --global color.ui true
Color codes the commit SHA
git log --pretty=oneline
or git log --graph --oneline --all
Commit and history is one line
git log --pretty=format:"%h
Exactly how you want the output using placeholders ( use git help log )
Date Ranges
Git log --until
##Removal
git rm <filename>
Removes file completely
git rm --cached <file names>
Won't be deleted from your file system just keeps the local changes still
##Help
git help
git help <command>
##Suggestions
Enjoy
##DISCUSSION
If you have questions, please use this Linkedin group
##License
This repo is released under the MIT License.