https://github.com/dunghenry/git_github
learn git + github
https://github.com/dunghenry/git_github
git github
Last synced: about 2 months ago
JSON representation
learn git + github
- Host: GitHub
- URL: https://github.com/dunghenry/git_github
- Owner: dunghenry
- Created: 2022-08-24T17:07:19.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-11-10T15:15:34.000Z (over 3 years ago)
- Last Synced: 2025-01-25T19:29:17.922Z (over 1 year ago)
- Topics: git, github
- Language: JavaScript
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Git vs GitHub
### Create repository
```
git init
```
### Create file README.md
```
git add README.md
```
### Create commit
```
git commit -m "first commit"
```
### Create branch
```
git branch -M main
```
### Managing remote repositories
```
git remote add origin https://github.com/username/repository_name.git
```
### Pushing to branch
```
git push -u origin main
```
### Unstage
```js
git rm --cached filename.js
```
### Stage
```js
git add .
```
```js
git add filename.js
```
### Add staging and commit
```js
git commit -a -m"message"
```
### Change commit
```js
git commit --amend
```
### Exit git log
```js
q;
```
### Override commit
```js
git push --force
```
### Log
```js
git log --oneline
```
### List branch
```js
git branch
```
### Create new branch
```js
git branch branchname
```
### Checkout branch
```js
git checkout branchname
```
### Create new branch from branch a
```js
git branch b a
```
### Create new branch and checkout
```js
git checkout -b branchname
```
### Merge branch to branch master
```js
git checkout master
git merge branchname
```