Skip to content

Instantly share code, notes, and snippets.

@vallard
Created March 7, 2016 23:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vallard/e52438240c20c24997c7 to your computer and use it in GitHub Desktop.
Save vallard/e52438240c20c24997c7 to your computer and use it in GitHub Desktop.
# create a git repo
```
git init mygit
cd mygit
echo "this is foo" > foo.txt
git status
git add .
git status
git commit -am "added foo"
echo "this is a change in foo" > foo.txt
git commit -am "updated foo"
git log
echo "added bar" > bar.txt
git log
git checkout asdfasdf foo.txt
# now foo.txt is back
# commit changes
# create project in github
# now add project
git remote add origin https://github.com/vallard/choochoo.git
git push -u origin master
### Branch
git branch
git branch twig
git checkout twig
echo "blah blah" > blah.txt
git add blah.txt
git commit -m "added blah"
ls
git checkout master
# now merge
git merge twig
# git rid of twig branch
git branch -d twig
git pull
```
# Git someone else's code
```
git clone https://github.com/<your username>/CiscoCloudDayLab1.git
git log --graph --decorate --abbrev-commit --all --pretty=oneline
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment