forked from docs/team-docs
Compare commits
2 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5ee5279ee6 | |||
| e89604431b |
3 changed files with 132 additions and 1 deletions
|
|
@ -4,6 +4,7 @@
|
|||
*** xref:content/contrib-release-notes.adoc[Contributing to Release Notes]
|
||||
*** xref:content/tools-file-edit-forge.adoc[Edit documentation in Forge]
|
||||
*** xref:content/tools-edit-local-clone.adoc[Edit documentation locally]
|
||||
*** xref:content/writers-git.adoc[Git cheat sheet]
|
||||
*** xref:content/tools-vale-linter.adoc[Check edits with Vale]
|
||||
|
||||
** xref:content/style-guide.adoc[The docs style guide]
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ Use this method for small changes, such as fixing typos or other simple edits th
|
|||
|
||||
== Preparation
|
||||
|
||||
* Complete the contributor https://docs.fedoraproject.org/en-US/fedora-docs/content/#_prerequisites[*prerequisites*].
|
||||
* Complete the contributor xref:index.adoc#_first_steps[*First steps*].
|
||||
|
||||
== Edit via the Forge web interface
|
||||
|
||||
|
|
|
|||
130
modules/contributing/pages/content/writers-git.adoc
Normal file
130
modules/contributing/pages/content/writers-git.adoc
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
include::partial$attributes.adoc[]
|
||||
:experimental:
|
||||
|
||||
= Git Cheat Sheet for Writers
|
||||
Eli Ridge (egret); Fedora Docs Team
|
||||
2026-09-01
|
||||
:description: Git commands used by Docs writers.
|
||||
:page-pagination:
|
||||
|
||||
This cheat sheet for docs writers provides some commonly used Git tasks and their respective commands.
|
||||
You will have previously cloned a repository (repo) to your computer and pushed to your remote fork on Forge.
|
||||
Refer to the xref:content/tools-edit-local-clone.adoc[Local workflow] guide to get started with Git.
|
||||
|
||||
[IMPORTANT]
|
||||
====
|
||||
This cheat sheet assumes that your Git configuration uses _origin_ for your remote fork and _upstream_ for the upstream repository.
|
||||
Run `git remote -v` to check these names.
|
||||
====
|
||||
|
||||
[[pull-upstream]]
|
||||
== Pulling updates from upstream
|
||||
|
||||
=== Update your local main branch:
|
||||
|
||||
Synchronizes the main branch of your local clone with the upstream repository's `main` branch:
|
||||
[source,console]
|
||||
----
|
||||
git switch main
|
||||
git pull upstream main
|
||||
# local main is now updated
|
||||
git push origin main
|
||||
# to update your fork in forge
|
||||
----
|
||||
|
||||
=== Update a local feature branch:
|
||||
|
||||
Synchronizes the given feature branch with the `main` branch of your local clone.
|
||||
|
||||
1. Change to the feature branch that you want to update:
|
||||
+
|
||||
[source,console]
|
||||
----
|
||||
git switch <branch-name>
|
||||
----
|
||||
|
||||
|
||||
2. Rebase the feature branch:
|
||||
+
|
||||
[source,console]
|
||||
----
|
||||
git rebase main
|
||||
----
|
||||
|
||||
=== Push your local branch to your remote fork:
|
||||
[source,console]
|
||||
----
|
||||
git push origin <branch-name>
|
||||
----
|
||||
The `--force-with-lease` flag may be needed if you have rebased a branch that has already been pushed.
|
||||
This should be used with caution.
|
||||
|
||||
|
||||
[[pull-remote]]
|
||||
== Pulling updates from your remote fork
|
||||
|
||||
=== Pull changes from your remote fork:
|
||||
|
||||
Synchronizes the respective branch of your local clone with your remote fork. Use this if you have made changes to your fork using the forge web interface.
|
||||
|
||||
[source,console]
|
||||
----
|
||||
git pull --rebase origin <branch-name>
|
||||
----
|
||||
|
||||
[[more-git-tasks]]
|
||||
== More tasks
|
||||
|
||||
=== List untracked changes:
|
||||
|
||||
Identifies your current branch and the files that have changes.
|
||||
[source,console]
|
||||
----
|
||||
git status
|
||||
----
|
||||
|
||||
=== List the commits about to be pushed:
|
||||
[source,console]
|
||||
----
|
||||
git log --oneline origin/<branch-name>..<branch-name>
|
||||
----
|
||||
|
||||
=== List staged files:
|
||||
[source,console]
|
||||
----
|
||||
git diff --name-only --staged
|
||||
----
|
||||
|
||||
|
||||
=== Push to your remote fork:
|
||||
[source,console]
|
||||
----
|
||||
git switch <branch-name>
|
||||
git push origin <branch-name>
|
||||
----
|
||||
|
||||
[[destructive-commands]]
|
||||
== Destructive commands
|
||||
|
||||
[WARNING]
|
||||
====
|
||||
Exercise caution when using the following commands.
|
||||
Incorrect use can result in lost data.
|
||||
====
|
||||
|
||||
=== Reset your feature branch:
|
||||
Results in the feature branches matching your main branch state exactly - disregards all changes to your feature branch.
|
||||
|
||||
[source,console]
|
||||
----
|
||||
git switch <branch-name>
|
||||
git reset --hard main
|
||||
----
|
||||
|
||||
=== Delete local branches that you no longer need:
|
||||
|
||||
[source,console]
|
||||
----
|
||||
git branch -d <branch-name>
|
||||
----
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue