oliverdavies.uk/content/node.3bb4452f-5bd7-4cce-8ec8-d68610e00b92.json

91 lines
4.9 KiB
JSON
Raw Normal View History

2025-04-21 02:34:46 +01:00
{
"uuid": [
{
2025-05-11 09:40:11 +01:00
"value": "3bb4452f-5bd7-4cce-8ec8-d68610e00b92"
2025-04-21 02:34:46 +01:00
}
],
"langcode": [
{
"value": "en"
}
],
"type": [
{
"target_id": "daily_email",
"target_type": "node_type",
"target_uuid": "8bde1f2f-eef9-4f2d-ae9c-96921f8193d7"
}
],
"revision_timestamp": [
{
2025-05-11 09:40:11 +01:00
"value": "2025-05-11T09:00:51+00:00"
2025-04-21 02:34:46 +01:00
}
],
"revision_uid": [
{
"target_type": "user",
"target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849"
}
],
"revision_log": [],
"status": [
{
"value": true
}
],
"uid": [
{
"target_type": "user",
"target_uuid": "b8966985-d4b2-42a7-a319-2e94ccfbb849"
}
],
"title": [
{
"value": "Git tricks to avoid committing commented-out and other unneeded code\n"
}
],
"created": [
{
"value": "2022-11-21T00:00:00+00:00"
}
],
"changed": [
{
2025-05-11 09:40:11 +01:00
"value": "2025-05-11T09:00:51+00:00"
2025-04-21 02:34:46 +01:00
}
],
"promote": [
{
"value": false
}
],
"sticky": [
{
"value": false
}
],
"default_langcode": [
{
"value": true
}
],
"revision_translation_affected": [
{
"value": true
}
],
"path": [
{
"alias": "\/daily\/2022\/11\/21\/git-tricks-to-avoid-committing-commented-out-and-other-unneeded-code",
2025-04-29 14:30:51 +01:00
"langcode": "en"
2025-04-21 02:34:46 +01:00
}
],
"body": [
{
2025-05-30 02:14:32 +01:00
"value": "\n <p><a href=\"\/daily\/2022\/11\/20\/version-controlled-commented-out-code\">Yesterday's email<\/a> talked about whether commented-out code should be present if your code is version-controlled, but how do you avoid committing it in the first place?<\/p>\n\n<p>You could make sure that you remove everything manually before you stage and commit your changes, or I like to use <code>git add --patch<\/code> (or <code>git add -p<\/code>) to interactively stage my changes, allowing me to select which parts of files I want to include in my commit and ignore anything else. The <code>--patch<\/code> option also works for other commands, including <code>checkout<\/code> and <code>reset<\/code>.<\/p>\n\n<p>If you've already committed something like some debug code, you can use <code>git commit --amend<\/code> to amend the previous commit before pushing it, or if you have a separate clean-up commit, you can use <code>git rebase --interactive<\/code> and either the squash or fixup options to amend the original commit.<\/p>\n\n<p>If some old code has been removed and you want to find it, you can use <code>git log -S<\/code> with a string to search for, and Git will show a list of commits where the specified string was changed.<\/p>\n\n<p>If instead, you wanted to search for text within the commit message, you can use <code>git log --grep<\/code> with a string like an issue number to see a list of commits with that text in the commit message subject line or body.<\/p>\n\n<p>I hope these tips help keep unwanted code out of your version-control repository.<\/p>\n\n ",
2025-04-21 02:34:46 +01:00
"format": "full_html",
2025-05-30 02:14:32 +01:00
"processed": "\n <p><a href=\"http:\/\/default\/daily\/2022\/11\/20\/version-controlled-commented-out-code\">Yesterday's email<\/a> talked about whether commented-out code should be present if your code is version-controlled, but how do you avoid committing it in the first place?<\/p>\n\n<p>You could make sure that you remove everything manually before you stage and commit your changes, or I like to use <code>git add --patch<\/code> (or <code>git add -p<\/code>) to interactively stage my changes, allowing me to select which parts of files I want to include in my commit and ignore anything else. The <code>--patch<\/code> option also works for other commands, including <code>checkout<\/code> and <code>reset<\/code>.<\/p>\n\n<p>If you've already committed something like some debug code, you can use <code>git commit --amend<\/code> to amend the previous commit before pushing it, or if you have a separate clean-up commit, you can use <code>git rebase --interactive<\/code> and either the squash or fixup options to amend the original commit.<\/p>\n\n<p>If some old code has been removed and you want to find it, you can use <code>git log -S<\/code> with a string to search for, and Git will show a list of commits where the specified string was changed.<\/p>\n\n<p>If instead, you wanted to search for text within the commit message, you can use <code>git log --grep<\/code> with a string like an issue number to see a list of commits with that text in the commit message subject line or body.<\/p>\n\n<p>I hope these tips help keep unwanted code out of your version-control repository.<\/p>\n\n ",
2025-04-21 02:34:46 +01:00
"summary": null
}
]
}