Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Difference between git Pull and git Merge?
#1
Firstly, it's become painfully clear that the reason my code and data is so out of date is because I didn't understand that "I" was responsible to taking certain steps to occasionally run the necessary git commands to sync the code on my server and then apply updates. My fault entirely.

So now, I find myself wanting to get my installation of CoreBOS completely up-to-date. I've been fighting with migrating my installation to a new server - the current code-base runs fine on the new server however I really do need to get this critter up to date.

I'm wondering what the difference in git pull and git merge is.

When I run git pull on my current installation I receive the following information on the console:
Code:
[mweaver@mail corebos]$ git pull

remote: Counting objects: 36600, done.
remote: Compressing objects: 100% (483/483), done.
remote: Total 36600 (delta 11577), reused 11346 (delta 11346), pack-reused 24771
Receiving objects: 100% (36600/36600), 21.71 MiB | 13 KiB/s, done.
Resolving deltas: 100% (26328/26328), completed with 1957 local objects.
From https://github.com/tsolucio/corebos
   17277d5..0c1402a  master     -> origin/master
 * [new branch]      aggwidget  -> origin/aggwidget
 * [new branch]      new_mobile_version -> origin/new_mobile_version
Updating 36c9eb9..0c1402a
error: Your local changes to the following files would be overwritten by merge:
        .gitignore
        Copyright.txt
        PEAR.php
        Popup.php
        Smarty/templates/AccountHierarchy.tpl
        Smarty/templates/ActivityReminderCallback.tpl
        Smarty/templates/AddMailAccount.tpl
        Smarty/templates/AddProductToPriceBooks.tpl
        Smarty/templates/AddProductsToPriceBook.tpl
        Smarty/templates/AdvanceFilter.tpl
        Smarty/templates/AuditTrailList.tpl
        Smarty/templates/Buttons_List.tpl
        Smarty/templates/Calculator.tpl
        Smarty/templates/Clock.tpl
        Smarty/templates/ComposeEmail.tpl
        Smarty/templates/CreateEmailTemplate.tpl
        Smarty/templates/CreateView.tpl
        Smarty/templates/CreateWordTemplate.tpl
        Smarty/templates/CurrencyDetailView.tpl
        Smarty/templates/CurrencyEditView.tpl
        Smarty/templates/CurrencyListView.tpl
        Smarty/templates/CurrencyListViewEntries.tpl
        Smarty/templates/CustomFieldMapping.tpl
        Smarty/templates/CustomView.tpl
        Smarty/templates/DefModuleView.tpl
        Smarty/templates/DetailViewEmailTemplate.tpl
        Smarty/templates/DetailViewFields.tpl
        Smarty/templates/DetailViewHidden.tpl
        Smarty/templates/DetailViewUI.tpl
        Smarty/templates/DisplayFields.tpl
        Smarty/templates/DocumentsListView.tpl
        Smarty/templates/DocumentsListViewEntries.tpl
        Smarty/templates/EditProfile.tpl
        Smarty/templates/EditViewHidden.tpl
        Smarty/templates/EditViewUI.tpl
        Smarty/templates/EmailDetailView.tpl
        Smarty/templates/EmailDetails.tpl
        Smarty/templates/Emails.tpl
        Smarty/templates/ExportRecords.tpl
        Smarty/templates/FieldAccessindex.tpl
        Smarty/templates/FieldOrderindex.tpl
        Smarty/templates/FindDuplicateAjax.tpl
        Smarty/templates/FindDuplicateDisplay.tpl
        Smarty/templates/GroupDetailview.tpl
        Smarty/templates/GroupEditView.tpl
        Smarty/templates/Header.tpl
        Smarty/templates/Home/HomeBlock.tpl
        Smarty/templates/Home/HomeButtons.tpl
        Smarty/templates/Home/Homestuff.tpl
        Smarty/templates/Home/MainHomeBlock.tpl
        Smarty/templates/HomeNews.tpl
        Smarty/templates/ImportStep1.tpl
        Smarty/templates/ImportStep2.tpl
        Smarty/templates/Inventory/ProductDetails.tpl
        Smarty/templates/JsArray.tpl
        Smarty/templates/ListEmailTemplates.tpl
        Smarty/templates/ListGroup.tpl
        Smarty/templates/ListLeadCustomFieldMapping.tpl
        Smarty/templates/ListLoginHistory.tpl
        Smarty/templates/ListRoles.tpl
        Smarty/templates/ListViewButtons.tpl
        Smarty/templates/ListViewEntries.tpl
        Smarty/templates/ListWordTemplates.tpl
        Smarty/templates/Login.tpl
        Smarty/templates/LoginFooter.tpl
        Smarty/templates/LoginHeader.tpl
        Smarty/templates/MailScanner/MailScannerEdit.tpl
        Smarty/templates/MailScanner/MailScannerFolder.tpl
        Smarty/templates/MailScanner/MailScannerInfo.tpl
        Smarty/templates/MailScanner/MailScannerRule.tpl
        Smarty/templates/MailScanner/MailScannerRuleEdit.tpl
        Smarty/templates/MailerExport.tpl
        Smarty/templates/MassEditForm.tpl
        Smarty/templates/MergeColumns.tpl
        Smarty/templates/MergeFields.tpl
        Smarty/templates/MySitesContents.tpl
        Smarty/templates/Organizationindex.tpl
        Smarty/templates/Popup.tpl
        Smarty/templates/PopupContents.tpl
        Smarty/templates/PrintEmail.tpl
        Smarty/templates/PrintReport.tpl
        Smarty/templates/ProfileDetailView.tpl
        Smarty/templates/QuickCreate.tpl
        Smarty/templates/QuickCreateHidden.tpl
        Smarty/templates/RelatedListContents.tpl
        Smarty/templates/RelatedListDataContents.tpl
        Smarty/templates/RelatedListNew.tpl
        Smarty/templates/RelatedListsHidden.tpl
        Smarty/templates/ReportColumns.tpl
        Smarty/templates/ReportColumnsTotal.tpl
        Smarty/templates/ReportDashbord.tpl
        Smarty/templates/ReportFilters.tpl
        Smarty/templates/ReportGrouping.tpl
        Smarty/templates/ReportRunContents.tpl
        Smarty/templates/ReportSharing.tpl
        Smarty/templates/Reports.tpl
        Smarty/templates/ReportsCustomize.tpl
        Smarty/templates/ReportsScheduleEmail.tpl
        Smarty/templates/ReportsStep0.tpl
        Smarty/templates/ReportsStep1.tpl
        Smarty/templates/ReportsType.tpl
        Smarty/templates/RoleEditView.tpl
        Smarty/templates/RolePopup.tpl
        Smarty/templates/RoleTree.tpl
        Smarty/templates/Rss.tpl
        Smarty/templates/SelectEmail.tpl
        Smarty/templates/SentMailFolders.tpl
        Smarty/templates/SetMenu.tpl
        Smarty/templates/Settings.tpl
        Smarty/templates/Settin
Aborting

I can guarantee I haven't changed any of these files if that is what is stopping the process from completing successfully. I have to admit that there is a lot about this process that clearly I don't understand... yet. I really want to understand this. I'm also aware of the fact that because I've not paid the proper attention to keeping my code up to date the database has suffered because it appears to be in a state where I might be stuck at this code level.

Another question i have is: Can I combine the git commands like this:
Code:
git pull merge
 
in order to force the process to merge the new files into the existing system? I haven't tried it yet because I don't understand enough about how git works.

Joe: I've been really frustrated the past week or so and its mostly due to the fact that I've taken on too much at one time while trying to keep up with my regular work-load. So, I think I'll just concentrate on this one thing here. Your help and guidance is much appreciated.
Mark

[i]If I could work while on horseback that's where I'd be doing it. There's nothing like riding... Gives new meaning to the phrase, ride to live... live to ride.[/i]
Reply
#2
One step at a time. there are a lot of little concepts to learn and small hurdles to jump over. be patient you'll get there and I will personally help you all the way. In fact, do not hesitate at all to contact me directly for help, you have my email and I am very easy to find on hangouts and gitter (where I invite you to join: https://gitter.im/corebos/discuss). I owe you that much at least !!

Now, to answer you question. "git pull" = "git fetch" + "git merge", so it isn't the same. Let me try to explain that. When you download a copy of coreBOS with "git clone" you get all the code in the state it is at that moment and ALL the history of changes that it has gone through. That historical information is saved in the .git directory. Now suppose we keep developing and a week goes by. Now your code is not up to date with the latest changes, so you have to launch "git fetch", that will bring into the history all the changes since you downloaded the code (or launched your last "fetch"). The "git fetch" command only updates the history, it does not update your code. So you could study each of the changes before applying them to your code. Mostly, we all just apply them, which is done by executing the "git merge" command. "git merge" will look in the history and apply any changes that are there that haven't been applied to your code. So every time you want to update your code you have to launch "git fetch" and "git merge". This is so common, and we do it so often that they have added a short cut for us: "git pull" = "git fetch" + "git merge".

In the end you can actually forget about all that and just always do a "git pull", that is what you need.

One last comment. Note that git will update your code, but it has no idea about your database. If that new code needs a new field to do some magic, that field will NOT be created by the code update. In fact, that code will break because it will look for the field and it won't find it. This is where coreBOS updater comes in. coreBOS updater is capable of analyzing the state of your code and compare it with the state of the database and apply any changes that are missing. It sounds like magic,.... and it is :-)

Finally, the error you are running into is most probably all about file permissions. It turns out that git controls the attributes of the files also, not just their contents. That means that if I set a file to have permission 664, and you have it set to 644, git sees that as a change and won't apply the update, even if the file contents hasn't changed at all. The easiest way around this is to deactivate the file permission/attribute control:

git config --global core.fileMode false

http://stackoverflow.com/questions/1580596/how-do-i-make-git-ignore-file-mode-chmod-changes

git status will show you a list of changed files, try that before and after the fileMode false command and you should see the difference.

Let me know how it goes.
Joe
TSolucio
Reply
#3
getting fuzzy brain like I used to in college but it's all good. That is good information and I really appreciate it. I'll refresh my copy of the production install on Merlin (that's the new server I'm migrating to and currently testing on).
Mark

[i]If I could work while on horseback that's where I'd be doing it. There's nothing like riding... Gives new meaning to the phrase, ride to live... live to ride.[/i]
Reply
#4
well... this was slightly different...
Code:
[mweaver@merlin corebos]$ git config core.fileMode false

[mweaver@merlin corebos]$ git pull
Updating 36c9eb9..0c1402a
error: Your local changes to the following files would be overwritten by merge:
        config.template.php
        include/js/en_gb.lang.js
        include/js/hu_hu.lang.js
        include/language/en_gb.lang.php
        include/language/hu_hu.lang.php
        log4php.properties
        modules/Accounts/language/hu_hu.lang.php
        modules/Administration/language/hu_hu.lang.php
        modules/Calendar/language/hu_hu.lang.php
        modules/Campaigns/language/hu_hu.lang.php
        modules/ConfigEditor/language/en_gb.lang.php
        modules/ConfigEditor/language/hu_hu.lang.php
        modules/Contacts/language/hu_hu.lang.php
        modules/CronTasks/language/hu_hu.lang.php
        modules/CustomView/language/hu_hu.lang.php
        modules/Documents/language/hu_hu.lang.php
        modules/Emails/language/en_gb.lang.php
        modules/Emails/language/hu_hu.lang.php
        modules/FieldFormulas/language/hu_hu.lang.php
        modules/Help/language/hu_hu.lang.php
        modules/HelpDesk/language/hu_hu.lang.php
        modules/Home/language/hu_hu.lang.php
        modules/Import/language/hu_hu.lang.php
        modules/Invoice/language/hu_hu.lang.php
        modules/Leads/language/hu_hu.lang.php
        modules/MailManager/language/hu_hu.lang.php
        modules/Migration/language/hu_hu.lang.php
        modules/Mobile/language/de_de.lang.php
        modules/Mobile/language/en_gb.lang.php
        modules/Mobile/language/hu_hu.lang.php
        modules/Mobile/language/nl_nl.lang.php
        modules/ModComments/language/hu_hu.lang.php
        modules/PBXManager/language/hu_hu.lang.php
        modules/Portal/language/hu_hu.lang.php
        modules/Potentials/language/hu_hu.lang.php
        modules/Products/language/hu_hu.lang.php
        modules/Project/language/de_de.lang.php
        modules/Project/language/es_es.lang.php
        modules/Project/language/hu_hu.lang.php
        modules/Project/language/nl_nl.lang.php
        modules/ProjectMilestone/language/de_de.lang.php
        modules/ProjectMilestone/language/es_es.lang.php
        modules/ProjectMilestone/language/hu_hu.lang.php
        modules/ProjectTask/language/de_de.lang.php
        modules/ProjectTask/language/es_es.lang.php
        modules/ProjectTask/language/fr_fr.lang.php
        modules/ProjectTask/language/hu_hu.lang.php
        modules/RecycleBin/language/hu_hu.lang.js
        modules/RecycleBin/language/hu_hu.lang.php
        modules/Reports/language/en_gb.lang.php
        modules/Reports/language/hu_hu.lang.php
        modules/Rss/language/hu_hu.lang.php
        modules/SMSNotifier/language/hu_hu.lang.php
        modules/SalesOrder/language/hu_hu.lang.php
        modules/ServiceContracts/language/hu_hu.lang.php
        modules/Services/language/hu_hu.lang.php
        modules/Settings/language/en_gb.lang.php
        modules/Settings/language/hu_hu.lang.php
        modules/System/language/hu_hu.lang.php
        modules/Tooltip/language/hu_hu.lang.php
        modules/Users/language/en_gb.lang.php
        modules/Users/language/hu_hu.lang.php
        modules/Utilities/language/hu_hu.lang.php
        modules/Vendors/language/hu_hu.lang.php
        modules/VtigerBackup/language/hu_hu.lang.php
        modules/WSAPP/language/hu_hu.lang.php
        modules/Webforms/language/en_gb.lang.php
        modules/Webforms/language/hu_hu.lang.php
        modules/Yahoo/language/hu_hu.lang.php
        modules/cbupdater/schema.xml
        modules/com_vtiger_workflow/language/en_gb.lang.php
        modules/com_vtiger_workflow/language/hu_hu.lang.php
        themes/alphagrey/style.css
        themes/woodspice/style.css
Please, commit your changes or stash them before you can merge.
Aborting
Mark

[i]If I could work while on horseback that's where I'd be doing it. There's nothing like riding... Gives new meaning to the phrase, ride to live... live to ride.[/i]
Reply
#5
execute this and show me the output:

git diff config.template.php
Joe
TSolucio
Reply
#6
(03-04-2017, 11:50 PM)joebordes Wrote: execute this and show me the output:

git diff config.template.php

Code:
[mweaver@merlin corebos]$ git diff config.template.php

diff --git a/config.template.php b/config.template.php
index 76231a8..03152cc 100644
--- a/config.template.php
+++ b/config.template.php
@@ -31,8 +31,8 @@ $USE_RTE = 'true';
 $PORTAL_URL = 'http://your_support_domain.tld/customerportal';

 // helpdesk support email id and support name (Example: 'support@your_support_domain.tld' and 'your-support name')
-$HELPDESK_SUPPORT_EMAIL_ID = '_USER_SUPPORT_EMAIL_';
-$HELPDESK_SUPPORT_NAME = 'your-support name';
+$HELPDESK_SUPPORT_EMAIL_ID = 'mweaver@compinfosystems.com';
+$HELPDESK_SUPPORT_NAME = 'CISS Support';
 $HELPDESK_SUPPORT_EMAIL_REPLY_ID = $HELPDESK_SUPPORT_EMAIL_ID;

 /* database configuration
@@ -44,13 +44,13 @@ $HELPDESK_SUPPORT_EMAIL_REPLY_ID = $HELPDESK_SUPPORT_EMAIL_ID;
       db_name
 */

-$dbconfig['db_server'] = '_DBC_SERVER_';
-$dbconfig['db_port'] = ':_DBC_PORT_';
-$dbconfig['db_username'] = '_DBC_USER_';
-$dbconfig['db_password'] = '_DBC_PASS_';
-$dbconfig['db_name'] = '_DBC_NAME_';
-$dbconfig['db_type'] = '_DBC_TYPE_';
-$dbconfig['db_status'] = '_DB_STAT_';
+$dbconfig['db_server'] = 'localhost';


:...skipping...
diff --git a/config.template.php b/config.template.php
index 76231a8..03152cc 100644
--- a/config.template.php
+++ b/config.template.php
@@ -31,8 +31,8 @@ $USE_RTE = 'true';
 $PORTAL_URL = 'http://your_support_domain.tld/customerportal';

 // helpdesk support email id and support name (Example: 'support@your_support_domain.tld' and 'your-support name')
-$HELPDESK_SUPPORT_EMAIL_ID = '_USER_SUPPORT_EMAIL_';
-$HELPDESK_SUPPORT_NAME = 'your-support name';
+$HELPDESK_SUPPORT_EMAIL_ID = 'mweaver@compinfosystems.com';
+$HELPDESK_SUPPORT_NAME = 'CISS Support';
 $HELPDESK_SUPPORT_EMAIL_REPLY_ID = $HELPDESK_SUPPORT_EMAIL_ID;

 /* database configuration
@@ -44,13 +44,13 @@ $HELPDESK_SUPPORT_EMAIL_REPLY_ID = $HELPDESK_SUPPORT_EMAIL_ID;
       db_name
 */

-$dbconfig['db_server'] = '_DBC_SERVER_';
-$dbconfig['db_port'] = ':_DBC_PORT_';
-$dbconfig['db_username'] = '_DBC_USER_';
-$dbconfig['db_password'] = '_DBC_PASS_';
-$dbconfig['db_name'] = '_DBC_NAME_';
-$dbconfig['db_type'] = '_DBC_TYPE_';
-$dbconfig['db_status'] = '_DB_STAT_';
+$dbconfig['db_server'] = 'localhost';
+$dbconfig['db_port'] = ':3306';

+$dbconfig['db_status'] = 'true';

 // TODO: test if port is empty
 // TODO: set db_hostname dependending on db_type
Mark

[i]If I could work while on horseback that's where I'd be doing it. There's nothing like riding... Gives new meaning to the phrase, ride to live... live to ride.[/i]
Reply
#7
Ok, that was not a good example, that file shows you have made changes there. you do not need to change this file so you can "git checkout config.template.php"
now show me

git status include/language/hu_hu.lang.php
Joe
TSolucio
Reply
#8
(03-05-2017, 12:39 AM)joebordes Wrote: Ok, that was not a good example, that file shows you have made changes there. you do not need to change this file so you can "git checkout config.template.php"
now show me

git status include/language/hu_hu.lang.php

[mweaver@merlin corebos]$ git status include/language/hu_hu.lang.php

# On branch master
# Your branch is behind 'origin/master' by 3343 commits, and can be fast-forwarded.
#   (use "git pull" to update your local branch)
#
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   include/language/hu_hu.lang.php
#
no changes added to commit (use "git add" and/or "git commit -a")
Mark

[i]If I could work while on horseback that's where I'd be doing it. There's nothing like riding... Gives new meaning to the phrase, ride to live... live to ride.[/i]
Reply
#9
sorry, I must have fallen asleep when I wrote that :-(
the correct command I'm looking for is:

git diff include/language/hu_hu.lang.php
Joe
TSolucio
Reply
#10
Holy cow! The response from that query is so long I've attached it as a text file. Not sure what any of it means but... see attached.


Attached Files
.txt   ReallyLongResponse.txt (Size: 125.28 KB / Downloads: 1)
Mark

[i]If I could work while on horseback that's where I'd be doing it. There's nothing like riding... Gives new meaning to the phrase, ride to live... live to ride.[/i]
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)