RHEL/Android/Git/repo switch branch in AOSP source

版权声明:hushui版权所有 https://blog.csdn.net/hushui/article/details/83378160

lake@localhost:~/Google/android-8.1.0_r33$cd .repo/manifests


lake@localhost:~/Google/android-8.1.0_r33/.repo/manifests$ git branch -a | grep   android-8.1.0_r33
  remotes/origin/android-8.1.0_r33
lake@localhost:~/Google/android-8.1.0_r33/.repo/manifests$  git branch -a | cut -d / -f 3  ## see all tags 

######## new branch is in local already


lake@localhost:~/Google/android-8.1.0_r33$ repo init -b  android-8.1.0_r33
.repo/manifests/: discarding 484 commits

Your identity is: Lake <[email protected]>
If you want to change this, please re-run 'repo init' with --config-name

repo has been initialized in /home/lake/Google/android-8.1.0_r33

lake@localhost:~/Google/android-8.1.0_r33$   repo forall -c git checkout  android-8.1.0_r33
lake@localhost:~/Google/android-8.1.0_r33$   repo forall -c git reset --hard

#########  new branch is NOT in local yet


lake@localhost:~/Google/android-8.1.0_r33$ repo init -u https://android.googlesource.com/platform/manifest -b android-8.1.0_r33

lake@localhost:~/Google/android-8.1.0_r33$  repo forall -c 'git reset --hard; git clean -f -d -x';    ### Clean all local changes
lake@localhost:~/Google/android-8.1.0_r33$ repo sync  -j32
.......................
Fetching projects: 100% (591/591), done.  
Deleting obsolete path /home/lake/Google/android-8.1.0_r33/external/libvorbis
Syncing work tree: 100% (591/591), done.  

device/asus/fugu-kernel/: discarding 1 commits
device/google/dragon-kernel/: discarding 1 commits
device/google/marlin-kernel/: discarding 1 commits
device/google/wahoo-kernel/: discarding 1 commits
device/huawei/angler-kernel/: discarding 1 commits
device/lge/bullhead-kernel/: discarding 1 commits
external/chromium-webview/: discarding 1 commits
prebuilts/abi-dumps/vndk/: discarding 1 commits
prebuilts/gcc/darwin-x86/aarch64/aarch64-linux-android-4.9/: discarding 1 commits
prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.9/: discarding 1 commits
prebuilts/gcc/darwin-x86/x86/x86_64-linux-android-4.9/: discarding 1 commits
prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/: discarding 1 commits
prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/: discarding 1 commits
prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/: discarding 1 commits
prebuilts/gradle-plugin/: discarding 1 commits
prebuilts/maven_repo/android/: discarding 1 commits
prebuilts/ndk/: discarding 1 commits
prebuilts/qemu-kernel/: discarding 1 commits
prebuilts/sdk/: discarding 1 commits
prebuilts/tools/: discarding 1 commits 


############# start a local repo branch for all git projects !!  ########### Attention the branch name

lake@localhost:~/Google/android-8.1.0_r33$  repo start  android-8.1.0_r33    --all   

####  'android-8.1.0_r33'  will be  ambiguous
Starting android-8.1.0_r33: 100% (591/591), done.  
lake@localhost:~/Google/android-8.1.0_r33$ 

  
lake@localhost:~/Google/android-8.1.0_r33$ repo branches
*  android-8.1.0_r33         | in all projects
lake@localhost:~/Google/android-8.1.0_r33$ 

####  'android-8.1.0_r33'  will be  ambiguous in branch name and tag name

You can explicitly specify whether you want a branch or a tag by using full name:

 git checkout refs/heads/android-8.1.0_r33
or

git checkout refs/tags/android-8.1.0_r33

lake@localhost:~/Google/repo-aosp-AndroidN7.1.x-8.1$ repo branch 
*  android-8.1.0_r33         | in all projects

repo forall -c git checkout  refs/tags/android-8.1.0_r33   <<<<<<< ---------- Checkout tag of android-8.1.0_r33

repo forall -c git branch  -D  android-8.1.0_r33 <<<<<<< ---------- delete all branches of android-8.1.0_r33 to avoid ambiguous

猜你喜欢

转载自blog.csdn.net/hushui/article/details/83378160