-
Notifications
You must be signed in to change notification settings - Fork 0
Git Workflow
Steve Gibbard edited this page Jul 20, 2024
·
1 revision
You can find the URL associated with the repository in GitHub
git clone https://github.com/gibbardsteve/git-notes.wiki.githttps://github.com/gibbardsteve/git-notes.wiki.git <directory>git checkout -b my-new-branchgit branchgit switch mainTo only delete branch if it is merged:
git branch -d my-new-branchTo delete branch regardless of if it is merged:
git branch -D my-new-branchTo determine which files have been changed, deleted, staged for commit or are untracked:
git status
On branch main
Your branch is up to date with 'origin/main'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: Home.md
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
deleted: Basic-Workflow.md
deleted: Git-Notes.md
deleted: Git-Setup.md
Untracked files:
(use "git add <file>..." to include in what will be committed)
git/
To stage all changes locally ready for commit:
git add .To stage a single file ready for commit:
git add <filename>Prior to commiting check:
-
You are on the right branch:
git branch main * my-new-branch -
All of the changes you want to commit are staged:
git status On branch my-new-branch Changes to be committed: (use "git restore --staged <file>..." to unstage) deleted: Basic-Workflow.md deleted: Git-Notes.md modified: Home.md new file: git/git-notes.md renamed: Git-Setup.md -> git/git-setup.md new file: git/git-workflow.md
-
Commit the changes locally:
git commit -m "your commit message" .
-
Push the changes to the remote repository:
git push origin my-new-branch
-
Check commit history:
git log
commit d029706bcd1f01aa1a18beb89c0208f764c03294 (HEAD -> my-new-branch, origin/my-new-branch)
Author: Author Name <author.name@org.com>
Date: Sat Jul 20 19:55:59 2024 +0100
docs: restructure notes and add home content