Git Status 中文乱码解决

现象:  

解决办法:打开Git Bash,执行git config --global core.quotepath false

linux init git project

  • GitHub上创建一个repositories项目,比如 :https://github.com/NightAlexLy/doc.git

  • 在自已的项目下面执行。 git init

  • 将资源文件添加到git。git add .

  • 提交 git commit -m "log message(自己的提交日志)”

  • git remote add origin https://github.com/NightAlexLy/doc.git,在github上面添加origin

  • git push -u origin master ,将代码同步至github。

  • 上面一步报错可能需要执行git pull --rebase origin

git提交每次都输入密码

  1. 查看git origin的地址: git remote -v
  2.  git remote rm origin
  3.  git remote add origin https://username:password@github.com/username/test.git
  4.  git push origin master

git 错误: Unable to find remote helper for ‘https’解决方法

  1. vi /etc/profile
  2. 添加"export PATH=$PATH:/usr/libexec/git-core"
  3. source /etc/profile
  4. 或者是安装问题
  5. make prefix=/usr all doc info ;# as yourself
  6. make prefix=/usr install install-doc install-html install-info ;# as root

git 回滚提交内容

  1. 先通过 git log 查找要回退的 节点(commit_hash)
  2. git reset --hard commit_hash
  3. git push origin HEAD --force
  4. git reset --hard origin/master
  5. 回退到任意版本
  6. git rebase -i
  7. 查看修改内容
  8. git show commit_hash

git 查看提交的日志

  1. 1.查看最新的commit
  2. git show
  3. 2.查看指定commit hashID的所有修改:
  4. git show commitId
  5. 3.查看某次commit中具体某个文件的修改:
  6. git show commitId fileName

git初始化

Git global setup

git config —global user.name “张三|zhangsan”
git config —global user.email “zhangsan@xxx.com”

Create a new repository

git clone ssh://git@gitlab.xxx.net:2289/zhangsan/xxx-integration.git
cd bill-integration
touch README.md
git add README.md
git commit -m “add README”
git push -u origin master

Existing folder

cd existing_folder
git init
git remote add origin ssh://git@gitlab.xxx.net:2289/zhangsan/xxx-integration.git
git add .
git commit -m “Initial commit”
git push -u origin master

Existing Git repository

cd existing_repo
git remote rename origin old-origin
git remote add origin ssh://git@gitlab.xxx.net:2289/zhangsan/xxx-integration.git
git push -u origin —all
git push -u origin —tags