Azure DevOps生成过程创建Git分支

时间:2018-12-20 09:10:19

标签: git tfs azure-devops git-branch

人们

我将简要介绍您的问题。我在TFS Git存储库中有一个Angular应用程序,现在我想用Azure DevOps构建该应用程序,完成后,我想从Master创建一个新的Git分支

构建过程运行顺利,仅无法创建新分支。你能帮助我吗 ?

我尝试使用

之类的Powershell脚本进行尝试
  

git分支[aNewBranch]管理员

  

git checkout -q [aNewBranch]

但是它不起作用。

1 个答案:

答案 0 :(得分:1)

我猜您需要从您的master分支中获取一个分支(所有更改均作为iin master分支)。

执行这些步骤。

Just check the logs 
    git log --oneline -10

Fetch everything from repo
    git fetch origin [or any remote name]

Keep checking the logs 
    git log --oneline -10

go to master branch 
    git checkout master
        if master branch does not exists in your local machine - 
            create it with : git checkout -b master 

Now you are in master branch. 

rebase with master branch 
    git rebase origin/master

If you have some code changes already done in master branch (I am guessing the changes are not committed) - 
        git commit -am "Commit message here.. for your changes" [params : a for all, m for message]

Keep checking the logs 
    git log --oneline -10

Currently you are in master with new changes [with new commit]

Now go to new branch with changes [as it is in master - I guess this is what you expect]
        git checkout -b NewBranch

Keep checking the logs 
    git log --oneline -10