diff --git a/Git_Workflow_Guide.md b/Git_Workflow_Guide.md index 80a97fe..beb13f5 100644 --- a/Git_Workflow_Guide.md +++ b/Git_Workflow_Guide.md @@ -16,12 +16,13 @@ - [Uncommitted Changes](#uncommitted-changes) - [Local Changes Overwrite](#local-changes-overwrite) - [Branch Name Mismatch](#branch-name-mismatch) -- [End of Day Errors](#end-of-day-errors) + - [End of Day Errors](#end-of-day-errors) - [Push Rejection Handling](#push-rejection-handling) - [Merge Conflict Resolution](#merge-conflict-resolution) ### 3. Detailed Workflow Processes - [Starting Work for the Day](#starting-work-for-the-day) +- [Branch and Directory Navigation](#branch-and-directory-navigation) - [Working on Tasks](#working-on-tasks) - [Handling Remote Changes](#handling-remote-changes) - [End of Day Procedures](#end-of-day-procedures) @@ -58,39 +59,83 @@ ```markdown START DAY: 1. git checkout main -2. git pull -3. git checkout -b working_projectname_YYYYMMDD +2. git branch # See which branch to checkout or create a new one +3. git pull origin main +4. git checkout -b working_projectname_YYYYMMDD ``` - ### Start Task Process ```markdown START TASK: -4. git status -5. Update task status to WORKING +1. git status +2. Show counts of Tasks by Status: +``` +- + ```bash + echo "WORKING tasks: $(grep -r "tags: .*WORKING" . | wc -l)" + echo "OPEN tasks: $(grep -r "tags: .*OPEN" . | wc -l)" + echo "CLOSED tasks: $(grep -r "tags: .*CLOSED" . | wc -l)" + ``` +```markdown +3. Identify Task to work on: + - grep -r "tags: .*WORKING" . # View WORKING tasks + - grep -r "tags: .*OPEN" . # View OPEN tasks + - grep -r "tags: .*CLOSED" . # View CLOSED tasks +4. nano filename.md +5. Update task status to WORKING if starting a new task ``` ### Save Work Process ```markdown SAVE WORK: -6. git add filename.md (or git add .) -7. git commit -m "message" +1. git add filename.md (or git add .) +2. git commit -m "message" ``` ### Complete Task Process ```markdown COMPLETE TASK: -8. Update task status to CLOSED -9. git add filename.md -10. git commit -m "Completed task message" +1. Update task status to CLOSED +2. git add filename.md +3. git commit -m "Completed task message" ``` ### End Day Process ```markdown END DAY: -11. git checkout main -12. git merge working_projectname_YYYYMMDD -13. git push -14. git branch -d working_projectname_YYYYMMDD +1. Review Changes: + - git status # Check current status + - git diff --name-only # List changed files + - git log --oneline # View recent commits +2. Check Branch Status: + - git branch --merged # List merged branches + - git branch --no-merged # List unmerged branches + - git branch -vv # View branch details +3. Merge and Push: + - git checkout main + - git merge working_projectname_YYYYMMDD + - git push +4. Clean Up: + - git branch -d working_projectname_YYYYMMDD # Delete merged branch + - git branch # Verify cleanup + - git status + ``` + +### Common Task Status Commands +```markdown +# Quick status checks +git status # Current repository status +git branch # List all branches +git diff --name-only # List modified files + +# Task status queries +grep -r "tags: .*WORKING" . # Find all WORKING tasks +grep -r "tags: .*OPEN" . # Find all OPEN tasks +grep -r "tags: .*CLOSED" . # Find all CLOSED tasks + +# Branch management +git branch --merged # Show merged branches +git branch --no-merged # Show unmerged branches +git branch -vv # Detailed branch information ``` [Back to Top](#git-workflow-guide-for-life-planner) @@ -168,6 +213,47 @@ If you get conflicts during the merge: - Create and switch to a new branch for today's work - Example: `git checkout -b working_financial_20231031` +## Branch and Directory Navigation + +### Best Practices +Always work from the life_planner root directory when creating and managing branches. This ensures proper version control and file tracking. + +```bash +# Correct approach (from life_planner root directory): +/mnt/d/OneDrive/GH_Repositories/life_planner$ git checkout main +/mnt/d/OneDrive/GH_Repositories/life_planner$ git pull origin main +/mnt/d/OneDrive/GH_Repositories/life_planner$ git checkout -b working_projectname_YYYYMMDD +``` + +### Benefits of Working from Root Directory +1. Git tracks all project files from the root directory +2. Ensures consistent branch management +3. Prevents potential branch/tracking issues +4. Maintains clear project history + +### Why Not CD Into Project Directory +- Git branches affect the entire repository +- Working from a subdirectory might: + - Cause confusion about which files are being tracked + - Lead to incomplete commits + - Make it harder to manage multiple task files + +### Example Workflow +```bash +# 1. Start in life_planner root +/mnt/d/OneDrive/GH_Repositories/life_planner$ + +# 2. Create/checkout branch +git checkout -b working_financial_20231101 + +# 3. Then you can edit files in any project subdirectory +vim ONG_Assessing_Financial_Situation/01_T_MS1_Connect_all_financial_accounts_in_Tiller.md + +# 4. Git commands will work for all modified files +git status # Shows changes across all directories +git add . # Stages changes from all directories +``` + ## Working on Tasks ### Before Starting a Task