PHP / CLI documentation browser

Git Search Tool

Maximum-coverage Git Q&A, workflows, troubleshooting, and command reference.

15 entries
Most-Used WorkflowstutorialCommit and push normal changesWhat is the standard edit, commit, and push sequence?

After editing and testing:

git status
git add -A
git commit -m "Describe the change"
git push

Use git add file1 file2 instead of git add -A when you only want selected files in the commit.

Source: Session Q&A · Tags: daily, add, commit, push, workflow · Link
Most-Used WorkflowscheatQuick safety check before pull or pushWhat should I check before synchronizing?
git status
git branch --show-current
git rev-parse --abbrev-ref @{u}

This shows uncommitted work, the current branch, and its tracking branch.

Source: Session Q&A · Tags: status, branch, upstream, safety, pull, push · Link
Most-Used WorkflowstutorialRelease a tested versionWhat is the short recipe for a new release?

After release changes are committed and tested:

./git-bump-version 3.0.0
git push origin main
git push origin --tags

The helper updates VERSION, commits it, and creates tag v3.0.0. The two pushes publish the branch and tag.

Source: Session Q&A · Tags: release, VERSION, tag, bump, push · Link
Most-Used WorkflowstutorialStart a normal work sessionWhat commands should I run before editing?

From a working copy:

git status
git checkout main
git pull

Resolve, commit, stash, or discard uncommitted work before pulling if Git reports a conflict or refuses to merge.

Source: Session Q&A · Tags: daily, pull, main, status, workflow · Link
Setup & SSHtutorialClone current project from the SSH serverHow 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:

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 & SSHtaskConfirm SSH access to the Git serverHow do I confirm SSH works before using Git?

Run 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.

Source: tasks.md · Tags: ssh, server, port 2222, key, connection · Link
Remote & SyncfaqCorrect SSH remote syntax with port 2222What was wrong with git remote add origin ssh -p 2222 user@host -i key?

git remote add accepts a remote name and one URL. SSH options such as -p and -i are not separate Git remote arguments. Use:

git remote add origin ssh://intel145@209.182.212.74:2222/home/intel145/websites/gitrepo/proj1.git

Configure the identity file in ~/.ssh/config or use GIT_SSH_COMMAND when needed.

Source: Session Q&A · Tags: remote add, ssh, port, 2222, identity file, url · Link
Remote & SyncglossaryMeaning of git remote add originWhat does git remote add origin mean?

The command stores a named connection from the local working copy to another repository:

git remote add origin <url>

origin is a conventional nickname. git push origin main means push local main to the repository named origin.

Source: Session Q&A · Tags: origin, remote add, alias, url · Link
Versions & TagstutorialMake changes and release v3.0.0How do I get current files, make changes, make v3.0.0, and update the server?
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 script updates VERSION, commits it, and creates v3.0.0.

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

Use tags to mark fixed release or milestone commits such as 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.

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
BranchescheatList local, remote, and all branchesHow do I list branches?
git branch       # local branches
git branch -r    # remote-tracking branches
git branch -a    # local and remote-tracking branches

Use git fetch origin --prune first if you need fresh remote branch information.

Source: Session Q&A · Tags: branch, list, local, remote, all · Link
BranchescheatShow the current branchHow do I check which branch I am currently on?
git branch --show-current

Alternatives: git branch, git rev-parse --abbrev-ref HEAD, or git status. git branch marks the current branch with *.

Source: Session Q&A · Tags: current branch, show current, HEAD · Link
Files & HistorycheatCompare README.md between v1 and v2How do I compare README.md in v1 versus v2?
git --no-pager diff v1 v2 -- README.md

Use full tag names such as v1.0.0 and v2.0.0 if that is how your tags are named.

Source: Session Q&A · Tags: diff, README.md, v1, v2, compare · Link
Files & HistorycheatList edited, staged, and untracked filesHow do I see files being edited or checked out?
git status

It groups files into staged changes, unstaged changes, and untracked files. Use it before committing, pulling, or pushing.

Source: Session Q&A · Tags: status, modified, staged, untracked, files · Link
Files & HistorycheatView or save README.md from v1How do I get v1 of README.md without changing current files?

View:

git show v1:README.md

Save separately:

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

This does not alter the current working copy.