Skip to content

Commit 9593540

Browse files
author
Erlend Egeberg Aasland
authored
Add section about comparing changes to the git bootcamp (#795)
1 parent bd2f31a commit 9593540

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

gitbootcamp.rst

+26
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,32 @@ Commit the files:
240240
241241
git commit -m "<message>"
242242
243+
.. _diff-changes:
244+
245+
Comparing Changes
246+
-----------------
247+
248+
View all non-commited changes::
249+
250+
git diff
251+
252+
Compare to the ``main`` branch::
253+
254+
git diff main
255+
256+
Exclude generated files from diff using an ``attr``
257+
`pathspec <https://git-scm.com/docs/gitglossary#def_pathspec>`_ (note the
258+
single quotes)::
259+
260+
git diff main ':(attr:!generated)'
261+
262+
Exclude generated files from diff by default::
263+
264+
git config diff.generated.binary true
265+
266+
The ``generated`` `attribute <https://git-scm.com/docs/gitattributes>`_ is
267+
defined in :file:`.gitattributes`, found in the repository root.
268+
243269
.. _push-changes:
244270

245271
Pushing Changes

0 commit comments

Comments
 (0)