usage: git checkout []
or: git checkout [] [] -- ...
git checkout develop -- js/meta-jstree.js
git checkout --orphan bootstrap-v4
新建一个无版本的分支
git proxy | |
git submodules | |
git clean untracked files |
usage: git checkout []
or: git checkout [] [] -- ...
git checkout develop -- js/meta-jstree.js
git checkout --orphan bootstrap-v4
新建一个无版本的分支
git clean -fd
Just do this: | |
git checkout master | |
Or, if you have changes that you want to keep, do this: | |
git checkout -b temp | |
git checkout -B master temp | |
# GIT Submodule HEAD detached from master? | |
Situation you described | |
After pulling changes from server, many times my submodule head gets detached from master branch. | |
This is a common case when one does not use submodules too often or has just started with submodules. I believe that I am correct in stating, that we all have been there at some point where our submodule's HEAD gets detached. | |
Cause: Your submodule is not tracking any or correct branch. Solution: Make sure your submodule is tracking the correct branch | |
$ cd <submodule-path> | |
# if the master branch already exists locally: | |
# (From git docs - branch) | |
# -u <upstream> | |
# --set-upstream-to=<upstream> | |
# Set up <branchname>'s tracking information so <upstream> | |
# is considered <branchname>'s upstream branch. | |
# If no <branchname> is specified, then it defaults to the current branch. | |
$ git branch -u <origin>/<branch> <branch> | |
# else: | |
$ git checkout -b <branch> --track <origin>/<branch> | |
Cause: Your parent repo is not configured to track submodules branch. Solution: Make your submodule track its remote branch by adding new submodules with the following two commands. | |
First you tell git to track your remote <branch>. | |
Second you tell git to update your submodule from remote. | |
$ git submodule add -b <branch> <repository> [<submodule-path>] | |
$ git submodule update --remote | |
If you haven't added your existing submodule like this you can easily fix that: | |
First you want to make sure that your submodule has the branch checked out which you want to be tracked. | |
$ cd <submodule-path> | |
$ git checkout <branch> | |
$ cd <parent-repo-path> | |
# <submodule-path> is here path releative to parent repo root | |
# without starting path separator | |
$ git config -f .gitmodules submodule.<submodule-path>.branch <branch> |
#只对github.com | |
git config --global http.https://github.com.proxy socks5://127.0.0.1:1080 | |
#取消代理 | |
git config --global --unset http.https://github.com.proxy) |
git clone https://github.com/torch/distro.git ~/torch --recursive Clone with --recursive Or run git submodule init && git submodule update for checkout new submodules.
git submodule add ssh://test@yy:/data/git/foo.git foo
git submodule add -b master [URL to Git repo];
git submodule update --remote
git submodule update --recursive --remote
git submodule update --recursive
git --recurse-submodules git pull --recurse-submodules
git submodule update --init --recursive
git submodule foreach git pull origin master
$ cd path/to/submodule $ git add $ git commit -m "comment" $ git push
$ cd /main/project $ git add path/to/submodule $ git commit -m "updated my submodule" $ git push
git push --recurse-submodules=on-demand