Git

本文最后更新于:2024年6月21日 凌晨

git init 初始化本地库

git status 本地库状态

$ git status	本地库状态
On branch master

No commits yet	

nothing to commit (create/copy files and use "git add" to track)	# 还没有文件

$ git status
On branch master

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        test.txt

nothing added to commit but untracked files present (use "git add" to track)

git config –list #查看git配置信息

img

查看用户名,密码和邮箱命令:

git config user.name 
git config user.password 
git config user.email 

设置或修改用户名,密码和邮箱命令:

git config --global user.name "freedom"
git config --global user.password "123456"
git config --global user.email "[email protected]"

git强制提交本地分支覆盖远程分支

git push origin 分支名 --force

Git分支

切换分支

git checkout branchName

查看分支

git branch -a

gitignore模板

*.class
*.log
*.lock

# Package Files #
*.jar
*.war
*.ear
target/

# idea
.idea/
*.iml/

*velocity.log*

### STS ###
.apt_generated
.factorypath
.springBeans

### IntelliJ IDEA ###
*.iml
*.ipr
*.iws
.idea
.classpath
.project
.settings/
bin/

*.log
*.log/
tem/

#rebel
*rebel.xml*

*.gitignore

使用码云

  1. 注册登录,完善信息
  2. 设置本机绑定SSH密钥,实现免密码登录
# 进入C:\Users\Admin\.ssh
# 生成公钥
ssh-keygen -t rsa

image-20230512201232227

  1. 添加密钥到码云

image-20240226181711731

  1. 使用码云创建自己的仓库

许可证:开源是否可以随意转载,开源但不能商业使用、不能转载,…限制

  1. 克隆自己的仓库

image-20240226181718854


Git
https://junyyds.top/2023/05/17/Git/
作者
Phils
发布于
2023年5月17日
更新于
2024年6月21日
许可协议