git log -p path #查看指定路径下的git日志
git lfs
git config core.ignorecase false
git checkout -f target-branch
本地协议、 http 协议、 ssh 协议、 git 协议
git config --global http.proxy socks5://127.0.0.1:1086
git config --global https.proxy socks5://127.0.0.1:1086
git config --global --unset http.proxy
git config --global --unset https.proxy
master
, HEAD
and origin
用命令行强制执行此命令, eg:
git add ./filename
git config core.excludesfile
在.git/config
文件下加入如下内容
[user]
name = marstau
email = taumars@hotmail.com
或者使用命令
git config --global user.email "taumars@hotmail.com"
git config --global user.name "marstau"
git clone --bare git://github.com/username/old_project.git
cd old_project.git
git push --mirror git@git.oschina.net:username/new_project.git
git gui
,git bash
删除注册表中(win 7 x64)
HKEY_CLASSES_ROOT\Directory\Background\shell\gitgui
HKEY_CLASSES_ROOT\Directory\Background\shell\gitbash
git checkout -b branch_name origin/branch_name #下载远程分支内容到本地
git checkout develop #切换分支
git branch -D develop_fix #删除本地分支
git checkout --orphan doc #创建新独立且干净的分支doc
git remote prune origin # 删除缓存的git远程分支
git rev-parse --short HEAD # 获取当前commit id
git push origin master
git reset --hard origin/develop # 重置到指定分支
git remote -v # 查看远程url
GIT_CURL_VERBOSE=1 git push origin
GIT_TRACE=1 git push origin
git clone -b [branch_name] --single-branch [url]
eg:
git clone -b 2 --single-branch https://git.oschina.net/marstau/testing.git
git add conf
git diff
git commit -am 'commit message'
git push
git remote prune origin && git tag -l | xargs git tag -d && git fetch -t -p -f
git submodule add -b main git@git.marstau.com:GROUPNAME/PROJECTNAME.git newdir
git mv newdir subdir/targetname
git rm --cached projectfolder -r
git submodule update --init --recursive # 下载子模块
ssh-keygen -t rsa -C "taumars@hotmail.com" -f out_file_name
cat .ssh/id_rsa.pub
git clone git@gitlab.example.com:group/project.git
git lfs install # initialize the Git LFS project project
git lfs track "*.iso" # select the file extensions that you want to treat as large files
cp ~/tmp/debian.iso ./ # copy a large file into the current directory
git add . # add the large file to the project
git commit -am "Added Debian iso" # commit the file meta data
git push origin master # sync the git repo and large file to the GitLab server,若无效,可先执行git config --add lfs.url "http://example.com/mygroup/projectname.git/info/lfs"
git clone git@gitlab.example.com:group/project.git
git lfs fetch master
git lfs track df_*_r #相当于添加了df_game_r,df_auction_r等文件
开发模型:Git Flow
代码库应该有一个、且仅有一个主分支。所有提供给用户使用的正式版本,都在这个主分支上发布。
主分支只用来分布重大版本,日常开发应该在另一条分支上完成。我们把开发用的分支,叫做Development。
ignore文件内容为
abc/
则a/b/c/abc/,abc/两个目录下的文件都会被忽略
若只是想忽略根目录的某个文件,则使用
/abc/
若只想忽略目录下的子目录文件而非目录下的文件
/vendor/*/
若想忽略目录但是排除一部分目录More
/Assets/UI/*
!/Assets/UI/Loading/
bundle exec jekyll serve
在~/.ssh/config
中,
Host "1.1.2.2"
IdentityFile ~/.ssh/id_rsa
User username
Host a.github.com
HostName github.com
IdentityFile ~/.ssh/id_rsa
User username
Host b.github.com
HostName github.com
IdentityFile ~/.ssh/id2_rsa
User username
然后使用
git clone a.github.com:m/p1.git
git clone b.github.com:n/p2.git
即可区分同一域名不同账号
git svn clone svn_url
git svn fetch // 下载到一半若被终止
git svn dcommit # push到远程
git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks reset -q --hard 70966585acf624592deeb34a0bf7e3a8a64adfef #重置到某个版本
使用git-svn,删除不了空目录(要通过svn删除)
git clean -df
fatal: Invalid revision range 753c5661d18d675448cb37e1e1f213145e49e1b0..refs/remotes/git-svn
rev-list --pretty=raw --reverse 753c5661d18d675448cb37e1e1f213145e49e1b0..refs/remotes/git-svn --: command returned error: 128
Solution:
# remove
.git/svn/refs/remotes/git-svn/.rev_map.b20deb0f-bac8-47a1-b91f-4ac96d4e9029
.git/svn/refs/remotes/git-svn/unhandled.log
upgrade Git-lfs-windows.exe
to newest version
因为对图片使用了git lfs
去除对图片的lfs即可。
chmod 755 ~/.ssh/* && \
chmod 600 ~/.ssh/id_rsa ~/.ssh/id_rsa.pub && \
chmod 644 ~/.ssh/known_hosts
使用软链接
branches: no limitMore
git -c color.branch=false -c color.diff=false -c color.status=false -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree push -v origin refs/heads/master:refs/heads/master
Pushing to git.marstau.com:Group/ios.git
batch response: Post "https://git.marstau.com/Group/ios.git/info/lfs/objects/batch": read tcp 127.0.0.1:64285->127.0.0.1:1086: read: connection reset by peer
error: failed to push some refs to 'git.marstau.com:Group/ios.git'
Uploading LFS objects: 0% (0/1), 0 B | 0 B/s, done.
Completed with errors, see above
gif lfs版本问题,2.13.3没问题