dataDesk BLOG

Welcome to the blog of Mr.G


Blog 6: Git commands.md | (Open) | (Share)

▲ Previous | Next ▼

/Dev/HowTo/Git

Last modified: November 12 2024 18:24:39

Basic Git commands

This guide outlines essential Git commands for setup, project initiation, staging, committing, branching, merging, and more.

Initial configuration involves setting a global username and email. Project setup can be achieved by creating a repository or cloning an existing one. Staging files and committing changes are crucial steps, with options to amend commits or stage all changes.

Branch management includes creating, switching, and deleting branches, while merging and rebasing ensure smooth integration of changes. Command sets for viewing status, inspecting history, and undoing changes are also provided.

Advanced commands cover sensitive data removal, squashing commits, modifying messages, managing merge conflicts, and recovering lost commits. Additionally, the guide addresses handling submodules, multiple remotes, and repository cleanup, promoting safe practices while using force-push and stash workflows.

1. Setup and Configuration

# Set a global username
git config --global user.name "Your Name"

# Set a global email
git config --global user.email "you@example.com"

# Display all Git configuration settings
git config --list

2. Starting a Project

# Initialize a new Git repository
git init

# Clone an existing repository from a URL
git clone <url>

3. Staging and Committing Changes

# Stage a specific file for commit
git add <file>

# Stage all changes in the current directory
git add .

# Commit changes with a message
git commit -m "message"

# Modify the last commit message or add more changes to it
git commit --amend

4. Branching

# List all branches
git branch

# Create a new branch
git branch <branch_name>

# Switch to a branch
git checkout <branch_name>

# Create and switch to a new branch
git checkout -b <branch_name>

# Delete a branch locally
git branch -d <branch_name>

5. Merging and Rebasing

# Merge a branch into the current branch
git merge <branch_name>

# Reapply commits on top of another branch
git rebase <branch_name>

# Abort a merge in progress
git merge --abort

# Abort a rebase in progress
git rebase --abort

6. Viewing and Inspecting

# Show the working directory and staging area status
git status

# View commit history
git log

# View a concise, graphical commit history
git log --oneline --graph

# Show details of a specific commit
git show <commit_hash>

# Show changes in the working directory (not staged)
git diff

# Show changes that are staged
git diff --staged

7. Undoing Changes

# Unstage a file
git reset <file>

# Discard all working directory changes
git reset --hard

# Move HEAD to a previous commit, keeping staged changes
git reset --soft <commit>

# Discard changes to a file
git checkout -- <file>

8. Remote Repositories

# Add a new remote repository
git remote add <name> <url>

# List remote repositories
git remote -v

# Push changes to a remote repository
git push <remote> <branch>

# Fetch and merge changes from a remote repository
git pull <remote> <branch>

# Fetch updates from a remote without merging
git fetch <remote>

9. Tagging

# Create a tag
git tag <tag_name>

# Create an annotated tag with a message
git tag -a <tag_name> -m "message"

# Push a tag to a remote
git push <remote> <tag_name>

10. Stashing

# Save changes to a stash
git stash

# Reapply the most recent stash and remove it from the stash list
git stash pop

# Reapply a stash without removing it
git stash apply

# List all stashes
git stash list

# Delete a specific stash
git stash drop

11. Advanced Commands

# Apply a specific commit from another branch
git cherry-pick <commit_hash>

# Binary search to find the commit that introduced a bug
git bisect

# Show a log of all references (HEAD changes)
git reflog

# Show who changed each line in a file
git blame <file>

12. Cleaning Up

# Remove untracked files
git clean -f

# Remove untracked files and directories
git clean -fd


Blog 7: background_+_css_grandient.md | (Open) | (Share)

▲ Previous

/Dev/Design

(Last modified: March 26 2025 10:48:17)

background + css grandient


:root {
  --font: "Inter", sans-serif;
  --body-color: #637381;
  --heading-color: #212b36;

  --body-bg-color: #ffffff;
  --body-bg-secondary-color: #d6e4ff;
  --body-bg-gradient: linear-gradient(90deg, var(--body-bg-color), var(--body-bg-secondary-color)); 

  --about-bg-color: #ffffff;
  --about-bg-secondary-color: #d6e4ff;
  --about-bg-gradient: linear-gradient(180deg, var(--body-bg-color), var(--body-bg-secondary-color)); 

  --primary-color: #3056d3; 
  --secondary-color: #591e8a;
  --primary-gradient: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  --white: #ffffff;
}

🎯 Here's a quick angle reference:

  • 0deg: top → bottom
  • 90deg: left → right
  • 180deg: bottom → top
  • 270deg: right → left
  • 135deg: top-left → bottom-right ✅ (what you're using)

💡 If you want left → right:

Use to right or 90deg:

--body-bg-gradient: linear-gradient(to right, var(--body-bg-color), var(--body-bg-secondary-color));

or

--body-bg-gradient: linear-gradient(90deg, var(--body-bg-color), var(--body-bg-secondary-color));


Who I am

"Just me, myself, and I, exploring the universe of unknownment, embracing the mystery of what lies beyond, one star at a time."

Share this page on Facebook | X.com | Reddit

Page Content

  • Image Git commands
    Published: 2025-04-04
    Read
  • Image background + css grandient
    Published: 2025-04-02
    Read

Tags

WebDev New York London AI NORWAY DIY Ideas Life Family News Clothing Invest Sports Health