Skip to content

Instantly share code, notes, and snippets.

@isaurssaurav
Created June 1, 2017 08:57
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 isaurssaurav/58befcb30426e4781532a7c01f1be6dd to your computer and use it in GitHub Desktop.
Save isaurssaurav/58befcb30426e4781532a7c01f1be6dd to your computer and use it in GitHub Desktop.
Github beginner
git add '*.txt'
git log: gives a committed with author and date
git remote add origin https://github.com/try-git/try_git.git
git push -u origin master
git
PULLING REMOTELY
Let's pretend some time has passed. We've invited other people to our GitHub project who have pulled your changes, made their own commits, and pushed them.
We can check for changes on our GitHub repository and pull down any new changes by running:
git pull origin master
git diff:
git diff HEAD: get a changed made from in latest commit and
git diff --staged: option to see the changes you just staged
UNSTANGE ANY FILE
git reset filename
CHECKOUT
git reset did a great job of unstaging octodog.txt, but you'll notice that he's still there. He's just not staged anymore. It would be great if we could go back to how things were before octodog came around and ruined the party.
Files can be changed back to how they were at the last commit by using the command: git checkout -- <target>. Go ahead and get rid of all the changes since the last commit for octocat.txt
git checkout -- octocat.txt
Branching
-create a new branch
git branch branch_name
-go to that branch
git checkout branchName
-- do all the things
--then commit
-Checkout to master
-git merge branchName
-git branch -d clean_up, delete a branch
-git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment