https://github.com/csalmeida/learning-git
Learning Git!
https://github.com/csalmeida/learning-git
git learning learning-by-doing
Last synced: about 1 month ago
JSON representation
Learning Git!
- Host: GitHub
- URL: https://github.com/csalmeida/learning-git
- Owner: csalmeida
- Created: 2018-05-21T17:43:21.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-03T19:25:01.000Z (about 8 years ago)
- Last Synced: 2025-03-18T01:55:26.493Z (over 1 year ago)
- Topics: git, learning, learning-by-doing
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Learning Git!
Learning how to use Git.
Most used commands:
- `git status` - tells you what has been updated.
- `git add filename` - adding a file to staging and Git will start tracking changes.
- `git commit -m "message content"` - registers changes to get ready to upload, a message is also required.
- `git push` - pushing a file/changes on to Github.
- `git pull` - do it every time you get back to the project before you make any changes.
Other commands:
- `git diff filename` - see the differences between the working directory and the staging area.
- `git log` - to refer back or view previous versions.
The commit you are currently on/latest commit, is known as the HEAD commit.
- `git show HEAD` - show info and all the file changes that have been committed.
Backtracking:
- `git checkout HEAD filename` - restore the file to when you last made a commit.
- `git reset HEAD filename` - removes the file from the staging area if you decide you don't want to commit it.
- `git reset commit_SHA` - undo a commit, use the first 7 characters if the SHA (hash code) of a previous commit.
Branching:
Having different branches allows you to work on multiple versions. Your main branch is known as the 'master' branch.
- `git branch` - tells you which branch you're on, lists any other branches on your machine.
- `git branch new_branch` - to create a new branch.
- `git checkout branch_name` - to switch to another branch.
=======