Skip to content

codepath/gitfoo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Git Foo

1- Where am I? Am I clean?

git status

2- What does my commit history look like?

git log
git log --oneline --graph --all --decorate

3- How can I alias a long Git command?

git config --global alias.lg "log --oneline --graph --all --decorate"

4- What have I changed since my last commit?

git diff HEAD

5- I messed up! How can discard ALL changes since my last commit?

git reset --hard

6- How do I switch between EXISTING branches?

git checkout somebranch

7- How do I create a NEW branch off of my current branch and move to it?

git checkout -b thenewbranch

8- How do I cut & paste changes across branches?

git stash
# check out the other branch...
git stash pop

9- How do I MERGE a feature branch into main?

git checkout main
git merge featurebranch

10- How do I update my local branch with commits from GitHub?

git fetch             # makes local aware of changes in remote
git checkout main     # in this example we wish to update main
git merge origin/main # merges main from GitHub into local main

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published