2024年9月20日 星期五
Useful Git command
### 1. Fetch all remote branches
```shell
git fetch origin
```
### 2. Pull update to local branch
```bash
git pull origin main --rebase --autostash
```
### 3. Rebase other branch to main branch
```bash
# checkout to main branch
git checkout main
git rebase xxx
```
### 4. Show branchs
``` bash
# show local branch
git branch
# show remote branch
git branch -a
```
### 5. Create branch
``` bash
git branch
```
### 6. Switch branch
``` bash
git checkout
```
### 7. Commit code change
``` bash
# In one line.
git commit -m
# Add commit message from file
git commit -F
# Edit commit message with editor
git commit -a
```
### 8. Revert
``` bash
#Reset
git reset HEAD # 還原 "指定" 的檔案狀態
git reset HEAD # 還原 "全部" 的檔案狀態
#Checkout
git checkout -- # 還原 "指定" 的檔案狀態
git checkout # 還原 "全部" 的檔案狀態
```
### 9. Compare
``` bash
# compare difference
git diff
# show difference file
git status
```
### 10. Push
``` bash
# first time
git push -u origin
# normal
git push
# force
git push -f
```
Append ccflag in yocto bbfile
Could append ccfllag with define flag which wanna to append like following
```bash
# CFLAGS_append_{actived_machine_name} = "-DHT_QCA_WIFI "
CFLAGS_append_chita-clr = "-DHT_QCA_WIFI "
```
訂閱:
文章 (Atom)