Created
January 29, 2013 21:55
-
-
Save samuelleach/4668293 to your computer and use it in GitHub Desktop.
Create a new GitHub repository and demonstrate basic git commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set up new repo on GitHub | |
curl -u 'samuelleach' https://api.github.com/user/repos -d '{"name":"gitProj"}' | |
# Clone repo in local directory | |
git clone https://github.com/samuelleach/gitProj.git | |
# Add a README.md and .gitignore file in the repo | |
cd gitProj | |
touch README.md .gitignore | |
# Stage the new files ready for commit | |
git add README.md .gitignore | |
# Commit changes, and push to origin | |
git commit -m 'First version' ; git status | |
git push origin master | |
# Now Modify the .gitignore file and push changes to origin | |
echo '*~' > .gitignore | |
git add .gitignore | |
git commit -m 'Ignore files modified with emacs' | |
git push origin master | |
# Create a dev branch and switch to it | |
git branch dev | |
git branch # Show the available branches | |
git checkout dev | |
git branch | |
# Now modify a file and merge back to master | |
echo 'README for gitProj' > README.md | |
git checkout -m master | |
# Commit the change and push back to origin | |
git add README.md | |
git commit -m 'First version' | |
git push origin master | |
# Demonstrate status and helper commands | |
git status | |
git remote -v |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment