Basics:
Install/set up Git
sudo apt-get install git # for Debian/Ubuntu users
brew install git # for Mac OS X users with Homebrew installed
Tell Git who you are
First, you need to tell Git who you are:
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
Clone a repository
git clone git@github.com:<your github account>/afraid-to-commit.git
$ git status
# On branch master
nothing to commit (working directory clean)
Create a new branch
$ git checkout -b amend-my-name
Switched to a new branch 'amend-my-name'
git checkout -b new-branch existing-branch
Stage your changes
git add attendees_and_learners.rst
Commit your changes
git commit -m "added my github name"
To make local branch as remote
git checkout -b new-branch existing-branch
git push
To Stash
git stash save or git stash -- for tracked files
git stash save -u or git stash -u -- for all files (including tracked)
git stash apply -- to apply stash on any branch
git stash pop -- to apply stash and immediately drop the stack of stash
git stash clear -- to clear stack of stash
Install/set up Git
sudo apt-get install git # for Debian/Ubuntu users
brew install git # for Mac OS X users with Homebrew installed
Tell Git who you are
First, you need to tell Git who you are:
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
Clone a repository
git clone git@github.com:<your github account>/afraid-to-commit.git
$ git status
# On branch master
nothing to commit (working directory clean)
Create a new branch
$ git checkout -b amend-my-name
Switched to a new branch 'amend-my-name'
git checkout -b new-branch existing-branch
Stage your changes
git add attendees_and_learners.rst
Commit your changes
git commit -m "added my github name"
To make local branch as remote
git checkout -b new-branch existing-branch
git push
To Stash
git stash save or git stash -- for tracked files
git stash save -u or git stash -u -- for all files (including tracked)
git stash apply -- to apply stash on any branch
git stash pop -- to apply stash and immediately drop the stack of stash
git stash clear -- to clear stack of stash
No comments:
Post a Comment