Git Command lines practice for Branch Management

Project name: Test-Jekyll-MM-Gem-based.github.io Quoted from: Github Jekyll minimal-mistakes Overview This Jekyll project uses a branch management strategy that separates concerns into dedicated branches: theme Branch: Contains theme-related files (layouts, includes, assets, etc.). posts Branch: Contains content-related files (posts, pages, etc.). main Branch: The primary branch for merging and running the project. Branch Creation and Management # Create and switch to the 'theme' branch git checkout -b theme # Remove content directories from the 'theme' branch git rm -r _posts _pages README.md git commit -m "Remove content directories from theme branch" # Merge .gitignore from main into theme git merge main -- .gitignore git commit -m "Update .gitignore in theme branch" # Switch back to the main branch git checkout main # Create and switch to the 'posts' branch git checkout -b posts # Remove theme directories from the 'posts' branch git rm -r _layouts _includes assets Gemfile Gemfile.lock index.html git commit -m "Remove theme directories from posts branch" # Merge .gitignore from main into posts git merge main -- .gitignore git commit -m "Update .gitignore in posts branch" # Switch to the 'main' branch git checkout main # Merge the 'theme' branch into 'main' git merge theme # Resolve any conflicts, then stage and commit git add . git commit -m "Merge theme branch into main" # Merge the 'posts' branch into 'main' git merge posts # Resolve any conflicts, then stage and commit git add . git commit -m "Merge posts branch into main" # Push the 'main' branch to the remote repository named 'origin' git push origin main # Clean up generated directories and update .gitignore # Switch to the 'posts' branch git checkout posts rm -rf _site/ .sass-cache/ .jekyll-cache/ git add .gitignore git commit -m "Add .gitignore to posts branch" # Switch to the 'theme' branch git checkout theme rm -rf _site/ .sass-cache/ .jekyll-cache/ git add .gitignore git commit -m "Add .gitignore to theme branch" # Ensure .gitignore consistency across all branches git checkout theme git merge main -- .gitignore git commit -m "Update .gitignore in theme branch" git checkout posts git merge main -- .gitignore git commit -m "Update .gitignore in posts branch" # Check repository status, including ignored files git status --ignored # Remove generated directories from git tracking (if necessary) git rm -r --cached _site .sass-cache .jekyll-cache git commit -m "Remove generated directories from Git tracking" # Verify ignored status git status --ignored # Only execute the following commands in the 'main' branch jekyll build jekyll serve # force copy from theme branch when in main branch git merge -X theirs theme # force copy, another option git checkout theme -- multilple_file_name_with_space

2025-1-14 · 3 min · Atom.X

Interacting with the System and Managing Memory

Original Course link: Interacting with the System and Managing Memory Module 2: Dynamic allocation most of the memory we have used has been located on the stack. Dynamic memory allocation gives a programmer much more flexibility, in that it allows you to request a specific amount memory to be allocated on the heap, so that it will not disappear with the stack frame of the calling function. heap vs. stack Stack vs Heap: What’s the difference? (educative.io) ...

2024-8-23 · 7 min · Atom.X

42 School - shell00/ C

shell shebang line (#!/bin/bash to tell the system which interpreter to use special or wired file name delimeter \ tab, to show the special or wired file name such as : % touch "23\\?\$*'MaRViN'*$?77&\\" -rw-r--r-- 1 linxu 2024_heilbronn 0 Jan 17 21:20 \?$*'MaRViN'*0\ % rm \\\?\$\*\'MaRViN\'\*0\\ # input \ and then click tab, the terminal will show us \\?\$\*\'MaRViN\'\*0\\ automatically, # for us to confirm it automatically. % ls -lRa *MaRV* | cat -e -rw-r--r-- 1 linxu 2024_heilbronn 3 Jan 17 21:51 "\?$*MaRViN*$?\"$ # the file size 3, it is wrong, use echo and terminator % to end the input % echo -n 42 > \"\\\?\$\*MaRViN\*\$\?\\\" % cat \"\\\?\$\*MaRViN\*\$\?\\\" 42% # The function of the % mark is to indicate that the prompt is on the same line as the output, # because there is no linefeed character at the end of the output. This can help you distinguish # between the output and the prompt, and avoid confusion. However, some shells may use different # symbols or colors to indicate this situation. man how to modify the file size, time, dates, link number, in terminal unix. how to use and read command manual. ...

2024-1-15 · 8 min · Atom.X

Multidimensional Arrays

Week 3, Multidimensional Arrays Incompatible Representations C语言中多维数组中不兼容表示 参考更多案例: github/c3w3_1.segmentation_fault.c github/c3w3_1.compiler_wrong.c #include <stdio.h> void printArray(int (*arr)[5], int rows) { for (int i = 0; i < rows; ++i) { for (int j = 0; j < 5; ++j) { printf("%d ", arr[i][j]); } printf("\n"); } } int main() { int twoDArray[3][5] = { {1, 2, 3, 4, 5}, {6, 7, 8, 9, 10}, {11, 12, 13, 14, 15} }; // 这将有效,因为函数期望一个指向包含5个整数的数组的指针 printArray(twoDArray, 3); return 0; }

2023-12-12 · 1 min · Atom.X

Pointers, Arrays, and Recursion 2

Week 2, Read pointer 2 #include <stdio.h> #include <stdlib.h> int f(int **r, **s){ int temp = **r; int temp2 = **s; int *z = *r; *r = *s; *s = z; printf("**r = %d\n",**r); printf("**s = %d\n",**s); *z += 3; **s -= 8; **r -= 19; return temp + temp2; } int main(void) { int a = 80; int b = 12; int * p = &a; int * q = &b; int x = f(&p, &q); printf("x = %d\n", x); printf("*p = %d\n", *p); printf("*q = %d\n", *q); printf("a = %d\n", a); printf("b = %d\n", b); return EXIT_SUCCESS; } Output **r = 12 **s = 80 x = 92 *p = -7 *q = 75 a = 75 b = -7 ...

2023-12-11 · 1 min · Atom.X