I have recently started working on a Python/ Django project that uses Git as its version control.
I am relatively new to Git, having not used it much before. I currently have a number of branches of development- and want to merge some of the changes on my current branch with the master, but don't want to merge all of the changes from this branch.
My thought was to compare the particular files on my local branch where the changes that I want to merge are, with the same files on the master branch, so that I could see which changes I want to keep, and which ones I want to discard. I was then planning on creating a new branch from master, and manually copying over the few changes that I want to keep from my current local branch.
I ran the following command from my local branch:
git diff budgetsReports3 master -- costing/views.py
in order to see the differences between the views.py file in the costing app on my local budgetsReports3 branch and the master branch.
This command has produced the following output:
diff --git a/costing/views.py b/costing/views.py
index 452b082..f8a3f77 100644
--- a/costing/views.py
+++ b/costing/views.py
@@ -1324,12 +1324,6 @@ def report_overview(request, project_id):
project = Project.objects.get(id=project_id)
budget = get_current_budget(project_id)
- #(01/12/2016 @ 1410) Add the missing code that's used in report_ccis(...) to display the individual CCI items on this page
- cci_total_exc_final = budget.cci_total_exc_vat_final
- print("cci_total_exc_final value in report_overview: ", cci_total_exc_final)
- cci_grouped_items = budget.cci_items.all().order_by('project_room', 'name')
- print("cci)grouped_items value in report_overview: ", cci_grouped_items)
- #(01/12/2016 @ 1410) Added missing code...
if not budget and not project.budget_versions.filter(current_marker=1):
Budget.objects.create(project=project, current_marker=1)
@@ -1343,9 +1337,6 @@ def report_overview(request, project_id):
'project': project,
'budget': budget,
'cci_total_exc': cci_total_exc,
- #(01/12/2016 @ 1410) Add the missing code that's used in report_ccis(...) to display the individual CCI items on this page
- 'cci_grouped_items': cci_grouped_items,
- #ERF(01/12/2016 @ 1410) Added missing code...
'item_total_exc': item_total_exc,
'total_exc': total_exc,
'total_exc_2': total_exc_2,
@@ -1460,15 +1451,11 @@ def report_by_class(request, project_id):
def report_ccis(request, project_id):
""" CCI items styled for pdf """
- print ("report_ccis called from costing/views.py (line 1463) ")
project = Project.objects.get(id=project_id)
budget = get_current_budget(project_id)
- #(06/12/2016 @ 1450) Create a boolean to determine whether or not to display 'Latest Sum'
cci_total_exc = budget.cci_total_exc_vat_final
cci_grouped_items = budget.cci_items.all().order_by('project_room', 'name')
- print ("Value of cci_total_exc in costing/views.py (line 1469): ", cci_total_exc)
- print ("Value of cci_grouped_items in costing/views.py (line 1470): ", cci_grouped_items)
I can see that the differences between the versions of the file on each of the branches are highlighted in red, but I'm not sure which branch is showing which 'difference'- presumably all of the differences shown by the diff command are where the file on my local branch is different to the file on my master branch? So I would just need to look through these, and see which ones I want to keep/ merge with my master branch? Or does it show the differences the other way round?
-exist only in first item and must be removed to produce second item from first.