https://github.com/freakwill/git-learn
Let us learn how to use git command
https://github.com/freakwill/git-learn
Last synced: 5 months ago
JSON representation
Let us learn how to use git command
- Host: GitHub
- URL: https://github.com/freakwill/git-learn
- Owner: Freakwill
- Created: 2024-11-29T08:38:15.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-06T10:15:52.000Z (over 1 year ago)
- Last Synced: 2025-06-25T02:05:37.762Z (about 1 year ago)
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# git-learn
Let us learn how to use git command and GitHub
Let us improve efficiency.
Let us cooperate!
## Reset
use the following command to go back to an old commit.
`get reset --hard `
Reset the current branch to the state of the commit specified by the n-th previous commit in the commit history, discarding all changes made after that commit and moving the HEAD pointer to that commit.
`get reset --hard Head@{n}`
## Branch
Create branch with `git branch new`
and go to the branch via `git checkout new`
## Merge
merge new to main by `git merge new`
## Action
create `.github/workflows/*.yml`
Example:
```yaml
name: MyAction
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Print OK
if: contains(github.event.head_commit.message, 'print')
run: echo "OK!"
```