PHP / CLI documentation browser

Git Search Tool

Search your Git setup notes, workflows, commands, FAQs, and release procedures.

18 entries
Setup & SSH glossary Bare repository versus working copy Which folder do I edit, and which folder stores the remote repository?

A bare repository is central storage with no checked-out files, such as /home/intel145/websites/gitrepo/proj1.git. Do not edit or run normal git add/git commit work there.

A working copy is where you edit, test, stage, commit, and push, such as ~/projects/proj1 on macOS or /home/intel145/websites/apps/proj1 on Linux.

Source: tasks.md Tags: bare repo, working copy, git.git, apps, server Link
Setup & SSH tutorial Clone current project from the SSH server How do I get the current version of a project from the remote repository?

Use the ssh:// URL form so the custom port is included:

mkdir -p ~/projects
cd ~/projects
git clone ssh://intel145@209.182.212.74:2222/home/intel145/websites/gitrepo/proj1.git proj1
cd proj1

Verify the clone:

git remote -v
git branch -a
cat VERSION
git describe --tags --always
Source: faq4.md Tags: clone, ssh, remote, current version, macos, linux Link
Setup & SSH task Confirm SSH access to the Linux Git server How do I confirm SSH works before using Git?

Run this from macOS or another Linux client:

ssh -p 2222 intel145@209.182.212.74 'echo SSH_OK'

If it prints SSH_OK, SSH connectivity works. Git over SSH will not work until this succeeds. A reusable ~/.ssh/config entry can define the host, user, port, and identity file once.

Source: tasks.md Tags: ssh, server, port 2222, key, connection Link
Remote & Sync task Confirm a working copy points to the correct remote How do I check or fix the remote URL?

Inspect configured remotes:

git remote -v

Set or repair the origin URL:

git remote set-url origin ssh://intel145@209.182.212.74:2222/home/intel145/websites/gitrepo/proj1.git

If no origin remote exists yet, use git remote add origin <url> instead.

Source: tasks.md Tags: remote, origin, set-url, ssh url, push, fetch Link
Remote & Sync tutorial Get latest files from remote main How do I pull the current project files before starting work?

From a clean working copy:

git fetch origin
git checkout main
git pull

If you have uncommitted edits, Git may refuse to merge. Commit, stash, or discard those changes first.

Source: tasks.md Tags: pull, fetch, main, latest, sync, remote Link
Workflows tutorial Clone proj1 into a separate proj1fix working folder How do I get latest proj1 into dev/proj1fix, edit it, and send changes back?

Create a separate working copy:

mkdir -p ~/dev
cd ~/dev
git clone ssh://intel145@209.182.212.74:2222/home/intel145/websites/gitrepo/proj1.git proj1fix
cd proj1fix

Then edit, test, commit, and push:

git add -A
git commit -m 'Fix description'
git push origin main
Source: git.cheatsheet.md Tags: proj1, proj1fix, clone, fix, push Link
Workflows tutorial Use macOS and Linux working copies with one server repository Is it correct to develop on macOS and Linux against one central repo?

Yes. Each machine has its own working copy; the Linux bare repository is the shared central storage. On whichever machine you begin work, first pull main. Edit, test, commit, tag a release when ready, and push. On the other machine, pull before starting more work.

Typical cycle:

git checkout main
git pull
# edit and test
git add -A
git commit -m 'Change description'
git push origin main
Source: faq2.md Tags: macos, linux, two environments, central repo, sync Link
Versions & Tags cheat Check current project version and release state How do I tell what project version or tag I have?

Run:

cat VERSION
git describe --tags --always
git status

A clean working tree and an exact tag such as v2.1.0 indicate a released state. Output such as v2.1.0-3-gabcd123 means the current commit is three commits beyond that tag.

Source: faq3.md Tags: VERSION, describe, tag, current version, status Link
Versions & Tags tutorial Make changes and release v3.0.0 How do I get current files, make changes, make v3.0.0, and update the server?

From an existing clone:

git checkout main
git pull
# edit and test files
git add -A
git commit -m 'Implement v3 features'
./git-bump-version 3.0.0
git push origin main
git push origin --tags

The version script updates VERSION, commits it, and creates tag v3.0.0; the two push commands publish both commits and tags.

Source: faq4.md Tags: release, v3.0.0, VERSION, tag, push, workflow Link
Versions & Tags faq When to use tags When should I use tags?

Use tags to mark fixed release or milestone commits, for example v1.0.0, v2.0.0, and v2.1.0. A branch is for ongoing development; a tag is a named snapshot that should normally remain unchanged.

Create an annotated release tag:

git tag -a v2.0.0 -m 'Release v2.0.0'
git push origin --tags
Source: faq1.md Tags: tag, release, version, milestone, v1, v2 Link
Branches tutorial Maintain v2 while developing v3 When do I need a version branch such as 2.x?

Use long-lived maintenance branches only when two major versions need support simultaneously. For example, make 2.x from the v2 release tag for v2-only fixes while main moves toward v3:

git checkout v2.0.0
git checkout -b 2.x
git push -u origin 2.x

Make the v2 fix on 2.x, tag v2.0.1, and push the branch plus tags.

Source: faq1.md Tags: 2.x, 3.x, maintenance, hotfix, parallel versions Link
Branches faq When to create a new branch When do I change to a new branch?

For one active release line, stay on main and use tags for v1, v2, v3, and so on. Create a branch when work needs isolation: a large feature, experiment, risky refactor, or a maintenance fix for an older version while new development continues.

Example:

git checkout main
git pull
git checkout -b feature/new-auth
Source: faq3.md Tags: branch, feature, experiment, main, maintenance Link
Files & History faq Add selected files and ignore files/folders How do I git add a list of files and ignore files or folders?

Stage a selected list:

git add README.md VERSION src/main.php

Create .gitignore rules such as:

*.log
tmp/
.DS_Store
.env
junk
old/

.gitignore does not affect files already tracked. To stop tracking a file but retain it locally:

git rm --cached junk
echo 'junk' >> .gitignore
git add .gitignore
Source: faq5.md Tags: git add, gitignore, ignore, folder, stage, untrack Link
Files & History cheat Compare README.md between v1 and v2 How do I compare README.md in v1 versus v2?

Use tags and a path separator:

git --no-pager diff v1 v2 -- README.md

Use full tags such as v1.0.0 and v2.0.0 if those are the names in your repo.

Source: git.cheatsheet.md Tags: diff, README.md, v1, v2, compare Link
Files & History cheat List all tracked files in the current project version How do I list all files in proj1?

List tracked files:

git ls-files

List files in the current commit:

git ls-tree -r HEAD --name-only
Source: git.cheatsheet.md Tags: list files, ls-files, ls-tree, tracked Link
Files & History cheat List files currently being edited, staged, or untracked How do I see files being edited or checked out?

Run:

git status

It groups files into staged changes, unstaged changes, and untracked files. It is the first command to use before committing or pulling.

Source: git.cheatsheet.md Tags: status, modified, staged, untracked, files Link
Files & History cheat See the commit history of one file How do I see what versions of a file exist?

Show commits that changed a file, including tag decorations:

git log --decorate --oneline -- README.md

For detailed changes, use:

git log --decorate -p -- README.md
Source: faq3.md Tags: history, file versions, log, README.md, commits Link
Files & History cheat View or save README.md from v1 How do I get v1 of README.md without changing my current files?

View it:

git show v1:README.md

Save it separately:

git show v1:README.md > README.v1.md

This does not change the current working copy.