Reputation: 5355
I am making some changes to some ETL code and want to make sure I don't break anything.
I have a git repo and all of the files I am working on have been committed and stored on Bitbucket. (git push origin master
)
I believe that I should be making a new branch, correct? Will this reflect on Bitbucket as well or do I have to push it there somehow?
git branch config_changes
Now when I make some edits to my files will I just say the following?
git checkout config_changes
git add filename.py
git commit -m "changes"
git push origin config_changes
That will backup my changes to Bitbucket. Now, when I feel like the code is ready to replace my existing code, I just do:
git checkout master
git merge config_changes
git push origin config_changes
Or should that last line be git push origin master
?
Bonus question: I have Windows Task Schedule running .py files to automate some daily stuff. I want to make changes to files but keep the tasks running on the current (working) .py files. Is there a way to accomplish this? The task manager is pointing directly to a filename. Do I duplicate the folder for now?
Upvotes: 0
Views: 364
Reputation: 968
Yes, you are correct that big changes should be done in a remote branch. After you commit your first change to the dev branch and push it, you'll see the branch appear in BitBucket.
git checkout -b config_changes
*make changes*
git add filename.py
git commit -m 'message'
git push origin config_changes
The -b
flag in git checkout
tells git that you're creating a new branch from the current working branch (in your case, master).
When merging, you're on the right track but you should indeed git push origin master
. It is also good practice to git pull origin master
to ensure your master copy is in sync with the repository (for when others are working on the same project).
git checkout master
git pull origin master
git merge config_changes
git push origin master
Upvotes: 2