Jenkinsfile update using version control
It sounds like you want a when statement.
As I understand it, you want to execute stage B when you are on branch update/jenkinsfile. In order to do this, you need to add a condition to stage B:
pipeline {
    agent any
    stages {
        stage('A') {
            steps {
                sh 'echo &quot;Step A&quot;'
            }
        }
        stage('B') {
            when {
              branch 'update/jenkinsfile'
            }
            steps {
                sh 'echo &quot;Step B&quot;'
            }
        }
    }
}


Note that you also need your jenkins to discover this new branch - this will depend on how you have configured the job. The above assumes that you have a multibranch pipeline job which is configured to include that branch.