--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 😼 GIT commands 😼 GitHub commands --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 🔧 git --version Display Git version git --version 🆕 git init Initialize new Git repository git init 📖 git help Show help for a command git help init 📁 git clone Clone a repository git clone https://github.com/example/repo.git 📁 git remote -v List configured remotes git remote -v ⚙️ git config --global user.name Set Git username globally git config --global user.name "UserName" ⚙️ git config --global user.email Set Git email globally git config --global user.email user@example.com 📄 git status Show working tree status git status ➕ git add Add file(s) to staging area git add testfile.txt 📜 git commit -m "" Commit staged changes with message git commit -m "Initial commit" 📜 git commit -am "" Add modified tracked files and commit git commit -am "Update files" 📊 git log Show commit history git log 🔍 git diff Show changes not yet staged git diff 🔍 git diff --cached Show staged changes git diff --cached 🔄 git checkout Switch branch git checkout feature-branch 🆕 git switch Switch branch (newer syntax) git switch main 🌱 git branch List branches git branch ➕ git branch Create new branch git branch feature-1 🗑️ git branch -d Delete a branch git branch -d feature-1 🔄 git merge Merge branch into current git merge feature-1 📥 git pull Fetch and merge changes from remote git pull origin main 📤 git push Push commits to remote git push origin main 💾 git fetch Download objects and refs from remote git fetch origin ♻️ git reset --soft HEAD~1 Move HEAD backwards, keep staged and working git reset HEAD~1 --soft ♻️ git reset --mixed HEAD~1 Move HEAD backwards, reset staged only git reset HEAD~1 --mixed ♻️ git reset --hard HEAD~1 Move HEAD backwards, reset staged and working git reset HEAD~1 --hard 🧹 git rm Delete file and stage removal git rm unwanted_file.txt 🧹 git rm --cached Unstage file but keep it in working directory git rm --cached file.txt 📦 git tag Create a lightweight tag git tag v1.0.0 📦 git tag -a -m """ Create annotated tag git tag -a v1.0.1 -m "Release update" 🌐 git remote add origin Add remote named origin git remote add origin https://github.com/example/repo.git 🌐 git remote set-url origin Change URL for remote origin git remote set-url origin https://github.com/example/repo2.git 🔍 git show Show commit or tag details git show v1.0.0 📤 git push --tags Push tags to remote git push --tags 🪣 git stash Temporarily save changes git stash 🪣 git stash pop Apply last stash and remove it git stash pop --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 🔧 git --version Display Git version git --version 🆕 git init Initialize new Git repository git init 📖 git help Show detailed help for command git help init 📁 git clone Clone a remote repository git clone https://github.com/example/repo.git 📁 git clone Clone into named folder git clone https://github.com/example/repo.git myrepo 📋 git remote -v View configured remotes git remote -v 🌐 git remote add origin Add remote named origin git remote add origin https://github.com/example/repo.git 🌐 git remote set-url origin Update URL of remote origin git remote set-url origin https://github.com/example/repo2.git 🚀 git push Push commits to remote repository git push origin main 🚀 git push --tags Push tags to remote git push --tags 📥 git fetch Download objects and refs from remote git fetch origin 📥 git pull Fetch and merge changes git pull origin main 📥 git pull --rebase Fetch and rebase changes git pull --rebase origin main 📄 git status Show changes in working directory git status ➕ git add Stage file for next commit git add testfile.txt ➕ git add --all Add all changes (new, modified, deleted) git add --all 🗑️ git rm Remove file and stage deletion git rm obsolete.txt 🗑️ git rm --cached Unstage file (keep locally) git rm --cached temp.txt 📜 git commit -m "" Commit staged changes with message git commit -m "Initial commit" 📜 git commit -am "" Stage and commit modifications git commit -am "Updated files" ⏮️ git log View commit history git log 🕸️ git log --graph View commit history as graph git log --oneline --graph --decorate --all 🔍 git diff View unstaged changes git diff 🔍 git diff --cached View staged changes git diff --cached 🔀 git branch List branches git branch 🔀 git branch Create new branch git branch feature 🆕 git switch Switch branches git switch feature ❌ git branch -d Delete branch git branch -d feature 🔄 git merge Merge branch into current git merge feature ♻️ git rebase Reapply commits on top of another branch git rebase main ♻️ git rebase --continue Resume rebasing after conflict git rebase --continue 🚫 git reset --soft Move HEAD, keep staged and working git reset --soft HEAD~1 🚫 git reset --mixed Move HEAD, reset staged but keep working git reset HEAD~1 --mixed 🚫 git reset --hard Move HEAD and reset staging and working git reset HEAD~1 --hard 🔖 git tag Create inexpensive tag git tag v1.0 📜 git tag -a -m "" Create annotated tag git tag -a v1.0 -m "Release" 📥 git stash Save changes temporarily git stash 📥 git stash list List stashed changes git stash list 📥 git stash pop Apply and drop last stash git stash pop 🧮 git show Show details for commit or tag git show v1.0 📄 git cat-file -t Show object type git cat-file -t HEAD 📄 git cat-file -p Show object content git cat-file -p HEAD ⚙️ git config --global user.name Set global user name git config --global user.name "Your Name" ⚙️ git config --global user.email Set global user email git config --global user.email you@example.com 🧩 git blame Show line by line commit info git blame README.md 📤 git push --force Force push changes (dangerous) git push --force origin main 👀 git remote show Show remote details git remote show origin 🧹 git clean -fd Remove untracked files git clean -fd 🎛️ git reflog Show HEAD change history git reflog 👷 git bisect start Start bisecting to find bad commit git bisect start 👷 git bisect good Mark good commit git bisect good HEAD~10 👷 git bisect bad Mark bad commit git bisect bad HEAD~3 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 💪 Bicep & 🌎𝔸zure Pipelines related 😼 GIT commands --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ⚙️ git config --global init.defaultBranch main Set default branch on init git config --global init.defaultBranch main 🧰 git commit --amend Edit last commit git commit --amend -m "Updated commit message" 🧰 git push origin HEAD:refs/heads/main Push current branch to main on remote git push origin HEAD:refs/heads/main 🛠️ git checkout -b Create and switch to new branch git checkout -b deployment-config-update 🧰 git merge --no-ff Merge with explicit merge commit git merge --no-ff feature/new-bicep-config ⚡ git tag -a release-2025.09.04 -m "Bicep infra release" Create annotated release tag git tag -a release-2025.09.04 -m "Bicep infra release" 🏗️ git pull origin main Update local branch git pull origin main 🧪 git fetch origin Fetch changes from remote git fetch origin 🚦 git push origin main Push commits to remote main branch git push origin main 🔄 git rebase main Rebase current branch on main git rebase main --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 🌎𝔸zure DevOps & 😼 GitHub YAML pipeline specific commands --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 🧰 git config --global user.email "buildagent@example.com" Set build agent identity in pipeline git config --global user.email "buildagent@example.com" 🧰 git config --global user.name "Azure DevOps" Set build agent user name git config --global user.name "Azure DevOps" 📂 git ls-files List repository files in pipeline git ls-files 🪄 git checkout $(Build.SourceBranchName) Check out branch in pipeline git checkout refs/heads/feature-branch 📥 git pull origin $(Build.SourceBranchName) Pull changes in pipeline git pull origin feature-branch 🚀 git push origin HEAD:refs/heads/feature-branch Push changes after build git push origin HEAD:refs/heads/feature-branch 💥 git push --force-with-lease Push force respecting remote changes git push --force-with-lease ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------