Bash 스크립트를 사용하여 리파지토리를 리파지하는 방법을 찾으려하고 있습니다 만,이 방법을 사용하면 버그를 수정하는 방법을 모르는 몇 가지 오류가 많이 있습니다. : ./bash.sh: line 3: $'\r': command not found
Git 리포지토리를 리베이스하는 Bash 스크립트
오류 : - 창 캐리지 리턴이 유엔에 다른 여기
./bash.sh: line 3: $'\r': command not found
./bash.sh: line 6: $'\r': command not found
Updating Repo: /home/teste/ with url:
./bash.sh: line 8: $'\r': command not found
./bash.sh: line 16: syntax error near unexpected token `$'\r''
'/bash.sh: line 16: `(git fetch --all && git stash)
내가 그것은 스크립트 자체 파일 인코딩이 아니다
directory="/home/teste/" ## Where the server is located
original_dir="/root" ## Where we should back after the pull
cd $directory # switch to the git repo
repo_url=$(git config --get remote.origin.url)
echo "Updating Repo: $directory with url: $repo_url"
main_branch="master"
if [ "$repo_url" == "XXXXX" ]; then # if you have a repo where the primary branch isnt master
$main_branch="trunk"
fi
# update the repo, then stash any local changes
echo -e "\ncalling: git fetch --all && git stash"
(git fetch --all && git stash)
current_branch=$(git rev-parse --abbrev-ref HEAD)
# switch to master/trunk branch and rebase it, then switch back to original branch
if [ $current_branch != $main_branch ]; then
echo -e "\ncalling: git checkout $main_branch && git rebase && git checkout $current_branch"
(git checkout $main_branch && git rebase && git checkout $current_branch)
fi
# rebase the original branch and then stash pop back to original state
echo -e "\ncalling: git rebase && git stash pop on branch: $current_branch"
(git rebase && git stash pop)
#switch back to the starting directory
cd $original_dir
echo ""
우선 저장소를 리베이스하지 않으면 분기를 리베이스합니다. 그러나 제쳐두고 리베이스는 매우 복잡한 프로세스가 될 수 있으며, 병합이 발생할 수 있으며 종종 그렇게됩니다. bash 스크립트에서 병합 충돌을 어떻게 처리 할 계획입니까? –