it is important to keep track of branches and make sure you are not working on the wrong branch. Git provides a number of useful commands to help you list branches and keep track of branches
# Select all of the snippets you don't want to save$ git stash drop 六、分支(Branches) 18、我从错误的分支拉取了内容,或把内容拉取到了错误的分支 这是另外一种使用git reflog情况,找到在这次错误拉(pull) 之前HEAD的指向。 (main)$ git reflog ab7555f HEAD@{0}: pull origin wrong-branch: Fa...
$ git stash drop 分支(Branches) 我从错误的分支拉取了内容,或把内容拉取到了错误的分支 这是另外一种使用git reflog情况,找到在这次错误拉(pull) 之前HEAD的指向。 (main)$ git reflog ab7555f HEAD@{0}: pull origin wrong-branch: Fast-forward c5bc55a HEAD@{1}: checkout: checkout message goes...
Create a new branch / 建立一個新分支 gitbranch [branchName] List all remote or local branches / 列出所有遠端或本地分支 gitbranch -a Delete a branch / 刪除分支 gitbranch -d [branchName] Merge changes into current branch / 將變更合併到目前分支 gitmerge [branchName] Checkout an existing br...
git branch -aList all branches (local and remote) git branch [branch name]Create a new branch git branch -d [branch name]Delete a branch git push origin --delete [branch name]Delete a remote branch git checkout -b [branch name]Create a new branch and switch to it ...
git commands - branch Create and switch to a new branch git checkout -b newbranch Push local branch to remote, if remote branch does not exist, create it. git push origin local_branch:remote_branch List all branches/remote branches
No need to remember all those commands and parameters: get our popular "Git Cheat Sheet" - for free! Download Now for Free Usage Examples You can listallbranches (both local and remote), including the SHA-1 hashes and commit subjects that these branches currently point to: ...
分支(Branches) 我从错误的分支拉取了内容,或把内容拉取到了错误的分支 这是另外一种使用 git reflog 情况,找到在这次错误拉(pull) 之前HEAD的指向。 (main)$ git reflog ab7555f HEAD@{0}: pull origin wrong-branch: Fast-forward ...
List Of Commands To Create Git Branch From Current Git checkout <branch_name>: This command switches between branches. For example, if you wanted to switch from master to a new feature branch called my-new-feature, you should run the following command: $ git checkout my-new-feature. Git...
switch Switch branches tag Create, list, delete or verify a tag object signed with GPG collaborate (see also: git help workflows) fetch Download objects and refs from another repository pull Fetch from and integrate with another repository or a local branch ...