Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

git copy changes from one branch to another

Question:
I have a branch named BranchA from master. I have some changes in BranchA (I am not going to merge changes from BranchA to master).
Now I have created another branch from master named BranchB.
How can I copy the changes from BranchA to BranchB?

Answer:
git checkout BranchB
git merge BranchA

or if you didn't create BranchB yet you can do:
git checkout BranchA
git checkout -b BranchB

This is all if you intend to not merge your changes back to master. Generally it is a good practice to merge all your changes back to master, and create new branches off of that.

Also, after the merge command, you will have some conflicts, which you will have to edit manually and fix.

Make sure you are in the branch where you want to copy all the changes to. git merge will take the branch you specify and merge it with the branch you are currently in.
Comment

PREVIOUS NEXT
Code Example
Shell :: greater than certain value from pipe shell 
Shell :: mc for ubuntu linux 
Shell :: Why double tapping icon doesnt minimize in ubuntu 
Shell :: what is regedit in windows 
Shell :: how to run "npm start" ansible pm2 
Shell :: permission in linux 
Shell :: mongodb version check 
Shell :: install kex in kali linux wsl 
Shell :: vi replace pattern 
Shell :: terminator linux is not start 
Shell :: git clone vs add remote 
Shell :: install docker in suse linux 
Shell :: how to define a command in bashrc 
Shell :: windows workspace shortcut 
Shell :: turtlebot installation 
Shell :: powershell delete all files wit hextension 
Shell :: add my current project to an already existing GitHub repository 
Shell :: bitnami wordpress enable ssh 
Shell :: docker container logs host path 
Shell :: overclock raspberry pi zero 2w 
Shell :: zsh terminal 
Shell :: Install the postgres CLI tools 
Shell :: mongoalchemy flask 
Shell :: git deleted files update 
Shell :: how to move git clone to another git repo 
Shell :: apt install package version 
Shell :: rescale kubectl 
Shell :: How to download torrents from the command-line on Linux 
Shell :: create a directory 
Shell :: jq list top nodes 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =