Merging Git branches
- Create a project directory
mkdir pythonapp
- Initialize Git
git init
- Create a branch called as
production
git checkout -b production
- Create some file to be committed
echo "This is a python app" > app.py
echo "flask" > requirements.txt
- Add and commit the changes
git add .
git commit -m "Production Code"
- Now lets create a development branch
git checkout -b development
- Get the list of branches
git branch
- Lets do some changes in application file
echo "Adding a new feature" >> app.py
cat app.py
- Add and commit the changes
git add .
git commit -m "New Feature Added Code"
- Now switch to
production
branch
git checkout production
- Now lets merge changes in
development
branch toproduction
branch
git merge development