2025-08-05 13:24:21

This commit is contained in:
swangnice
2025-08-05 13:24:21 +08:00
parent 64eed4e7ce
commit 8a920994bf
268 changed files with 8347 additions and 15561 deletions

View File

@@ -2,6 +2,7 @@
title = 'Coding'
date = 2024-09-20T04:17:50Z
draft = false
weight = 90
+++

View File

@@ -0,0 +1,62 @@
+++
title = 'Git'
date = 2024-09-20T04:17:50Z
draft = false
+++
## Submodule
## Commit
1. Add date and time in commit messages:
``` bash
git commit -m "$(date '+%Y-%m-%d %H:%M:%S')"
```
## Remote
Check the remote url:
``` bash
git remote -v
```
If the remote url existing, set a new one:
``` bash
git remote set-url origin <new_remote_address>
```
A Trick: you can connect your local repo to 2 remote repos:
``` bash
git remote add public https://<git_domain>/<username>/project-public.git
git remote add private https://<git_domain>/<username>/project-private.git
```
## Branch
List all branches:
``` bash
git branch -a
```
Move to a specific branch, the branch where you are currently working is marked with an asterisk (*):
``` bash
git checkout <branch_name>
```
Create a new branch and switch to it:
``` bash
git checkout -b <new_branch_name>
```
## Push
Let us break down the push command:
``` bash
git push origin main
```
, where `origin` is the remote name and `main` is the branch name. If you want to push to a different remote or branch, just replace them accordingly.
More advanced usage:
``` bash
git push <remote_name> <local_branch_name>:<remote_branch_name>
```

View File

@@ -1,14 +0,0 @@
+++
title = 'Git'
date = 2024-09-20T04:17:50Z
draft = false
+++
## submodule
## Commit
1. Add date and time in commit messages:
``` bash
git commit -m "$(date '+%Y-%m-%d %H:%M:%S')"
```