java 发表于 2017-8-17 18:17:26

本帖最后由 java 于 2017-11-23 16:16 编辑

missing change-id


git commit -a --amend -s

查看某条日志的具体修改内容
git show cdb90e69217a7ac65bc6e52e2622066a05aa10cf

用git show <commit-hashId> 便可以显示某次提交的修改内容同样 git show <commit-hashId> filename 可以显示某次提交的某个内容的修改信息。
查看某一文件的历史性改动

git log --pretty=oneline 文件名

查看某一目录的修改日志
git log --pretty=format:'%h was %an, %ar, message: %s' srcdir

修改git log默认的时间显示方式
git config log.date iso临时git config log.date iso--global


查看配置信息
npm config ls -l

设置代理
npm config set proxy http://proxyhostname:proxyport
npm config set https-proxy http://proxyhostname:proxyportnpm的代理设置

git config --global http.proxy "localhost:1080"
git config --global https.proxy http://proxy.com:1234
git config --global https.proxy https://127.0.0.1:8580

移除代理
npm config rm proxy
npm config rm https-proxy
>npm config set proxy null
>npm config set https-proxy null

npm config set proxy false
npm cache clean

--global~/.gitconfig
--system
$(prefix)/etc/gitconfig
--local
.git/config


//config
git config --global -l
git config --global --list

git config --global --unset http.sslverify


git config --global https.proxy http://127.0.0.1:1080git config --global https.proxy https://127.0.0.1:1080git config --global --unset http.proxygit config --global --unset https.proxynpm config delete proxygit config --global http.proxy 'socks5://127.0.0.1:1080'
git config --global https.proxy 'socks5://127.0.0.1:1080'
如果清理完了,还是连接原来的端口,则是下面shell脚本设置了环境变量export http_proxy=http://127.0.0.1:8787
export https_proxy=$http_proxy
git config --global http.proxy $http_proxy
git config --global https.proxy $https_proxy
/etc/profile
~/.bashrc       lantern会写到其它文件,直接在这重新定义export http_proxy=‘’
~/.profile

日志统计
git shortlog -sn按照提交的commit数量进行统计git shortlog -sn --since="7 weeks" --until="1 weeks"对某一个时间段进行统计









查看指定用户的git提交记录git log --author=username
username为指定的用户


java 发表于 2017-8-17 18:25:27

本帖最后由 java 于 2018-9-29 14:31 编辑

查看远程分支
git branch -a

查看本地分支
git branch

创建分支
git branch test

切换分支到test
git checkout test


删除本地分支
git branch -d test

删除远程分支
命令行 : $ git push origin --delete <BranchName>


查看clone的源码路径
git remote -v




git remote -av

git branch -av

java 发表于 2017-9-20 16:40:25

本帖最后由 java 于 2017-11-30 16:10 编辑

Linux下以https(用户名密码)方式同步代码
git clone https://github.com/xxx/shell.git
...
git commit
git push -u origin master


http://www.111cn.net/sys/linux/79505.htm



git reset --hard ecd265ac831681c035479d69948313ebf3a4c736//不保留改动过的内容


git reset 215b364ca8b6f8134230dfba38446594fbb31555   //保存改动过的内容

Qter 发表于 2021-3-8 15:33:38

Quick setup — if you’ve done this kind of thing before Set up in Desktop
or
HTTPSSSH




Get started by creating a new file or uploading an existing file. We recommend every repository include a README, LICENSE, and .gitignore.
…or create a new repository on the command line
echo "# MyNotebook" >> README.mdgit initgit add README.mdgit commit -m "first commit"git branch -M maingit remote add origin git@github.com:hechengjin/MyNotebook.gitgit push -u origin main

…or push an existing repository from the command line
git remote add origin git@github.com:hechengjin/MyNotebook.gitgit branch -M maingit push -u origin main

…or import code from another repositoryYou can initialize this repository with code from a Subversion, Mercurial, or TFS project.Import code




Qter 发表于 2021-12-1 14:00:11

重命名git tag
1. git tag newtag oldtag

2. git tag -d oldtag


3. git push origin :refs/tags/oldtag


4. git push --tags


Qter 发表于 2022-10-26 19:17:47

如果觉得一遍遍地输入密码很烦,可以按照这个页面 提供的方案来把密码保存起来。另外还有一个更简单但安全性低一些的方案。执行这行代码:git config credential.helper store在这之后你只需要再输入一次密码, Git 就会把你的密码保存下来,这之后就再也不用输入了。说它「安全性低」,是因为这条指令会让 Git 把你的密码以明文形式保存在你的电脑上。具体这两种保存密码的方案选择哪个,看你自己了。

Qter 发表于 2022-10-27 10:03:04

本帖最后由 Qter 于 2022-10-27 10:09 编辑

功能分支合并到主分支并删除功能分支

git checkout master

git pull # merge 之前 pull 一下,让 master 更新到和远程仓库同步


git merge feature1




git push


git branch -d feature1


git push origin -d feature1# 用 -d 参数把远程仓库的 branch 也删了






推送到远程分支
git checkout feature1git push origin feature1

页: 1 [2]
查看完整版本: git命令行操作