git clone -b feature-branch --single-branch --depth=5 git@git.ssh_address
git commit code:
git status
git add ./
git commit -m 'commit information'
git branch
git push origin feature-branch:myself-branch //在远端服务器创建myself-branch分支,并将 // feature-branch分支code提交上去
撤回提交:
git reset --soft HEAD^ // 不清除暂存区代码
git reset --hard HEAD^ // 清除本地暂存区代码
找回 git reset --hard 的数据:
git reflog // 查看本地提交记录
git reset --hard commit-id // 退回commit-id 处
update code and use same commit:
git commit --amend
git push origin -f
设置git log:
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
设置后 使用 git lg 查看log 更舒适
git push 到远端 发现有冲突:
git pull --rebase origin feature-branch --depth=10; //fetch远端代码
解决冲突
git rebase --continue
git push origin feature-branch:myself-branch
git 拉取某一个分支
git fetch origin feature-branch:local-branch --depth=10 //拉取远端feature-branch分支到本地 //并起名为local-branch
git checkout feature-branch // 切换分支
git cherry-pick commit-id //获取某个commit 进行本地merge