Github Basics using Command Line
My web designer often needs helps working with Git. Here's what I usually tell him.
Create a new git repository
Establish git username and password
git config user.name 'your user name'
git config user.email 'your e-mail'
Review the changes you've made.
Add all changes to the repository
git add -A
Commit to git
git commit -m 'explination of what you've done'
Using Git branches for sprints
Here's how to use branches for sprints.
Stash is a way for temporarily holding area for changes that are not ready to commit to a branch but you don't want to lose.
Stash a bunch of changes.
Show all stashed files
git stash list
Delete all items from a stash list
git reset --hard HEAD
Return the stashed files to their original place.
git stash apply
This takes the top item off of stash, applies it to the working copy and removes the item from stash list.
git stash pop
Add your stash files to their own branch name.
git stash branch name_of_branch
Git allows you to get one, single commit and apply it through
First go to your master branch
git checkout master
Review which commit you want to apply.
git cherry-pick 5dcxxxCOMMITxnumber
Count how many commits have been submitted (line-by-line) using the word count function.
git log --oneline | wc -l
List out the authors of each commit and their info. Filter by summary, number of commits and their e-mail addresss.
git shortlog -sne
Review remote branches.
git branch -r
Add an Alias
This is an example of a sophisticated git command. This command shows a list of all commits within a branch. Visualize all the branches –through
––all option. The decorate
––decorate option applies labels (such as HEAD, tag, etc) to the commits.
git log --graph --oneline --all --decorate
This command can be given an alias like this:
git config --global alias.name_of_alias "log --graph --oneline --all --decorate"