sh git.sh

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh git.sh相关的知识,希望对你有一定的参考价值。

# Reset/checkout a single file from remote origin `branch`
git fetch --all
git checkout origin/branch -- path/to/file

# Reset local repository branch to be just like remote repository HEAD
git fetch origin && git reset --hard origin/develop

# Update current branch from dev
# `git checkout dev; git pull origin dev; git checkout branch; git rebase dev`
git pull --rebase origin develop
git pull --rebase origin stage

# Update current branch from dev when there're uncommited changes
git stash && git pull --rebase origin develop && git stash apply

# Delete a local branch
git branch -d the_local_branch

# Remove a remote branch
git push origin :BRANCH

# New branch with local unstaged changes in the working directory
git checkout -b experiment

# How to remove a file from git source control but not delete it
git rm --cached file

# Stashing
git stash # = `git stash save` record the current state of the working directory
git stash list # list stashed modifications
git stash apply # restore (potentially on top of a different commit)

# Delete the last pushed commit
git push origin +hash^:BRANCH

# Set upstream branch
git branch BRANCH -u origin/BRANCH

# Revert repository to a commit
git revert --no-commit hash..HEAD
git commit

# Remove local branches except for "master"
git branch | grep -v "master" | xargs git branch -D

以上是关于sh git.sh的主要内容,如果未能解决你的问题,请参考以下文章

sh git.sh

sh git-nb.sh

sh git.sh

sh git-rebase.sh

sh git-impact.sh

sh 安装节点5.10-git.sh