git

install and config

//Installing on Linux:
sudo dnf install git-all

git config --global user.name "wenyan"
git config --global user.email "sabertobihwy@gmail.com"
git config --global --list

ssh-keygen -o -t rsa -C "sabertobihwy@gmail.com"

1. initialize a repo on github
echo "# newweb" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/sabertobihwy/newweb.git
git push -u origin main

credential manager里添加

name: wenyan

pwd: github-setting-developer setting- generate token

2. wants to remove the local git repo???
delete the .git folder
3. remove the file before push??
git rm -r --cached .idea/
git commit --amend
(enter commit message)

4. git reset --soft & git reset --hard

soft: 撤回一次commit,本地代码不变动

hard: 撤回到 last version,本地代码变动

posted @ 2023-10-27 23:52  PEAR2020  阅读(12)  评论(0)    收藏  举报