You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Git Tutorial.aux
+5-4Lines changed: 5 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -52,18 +52,19 @@
52
52
\@writefile{toc}{\contentsline {subsection}{\numberline {6.5}Merging Changes from a Feature Branch to the Main Branch}{15}{subsection.6.5}\protected@file@percent }
Copy file name to clipboardExpand all lines: Git Tutorial.tex
+9-6Lines changed: 9 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -360,12 +360,15 @@
360
360
\subsubsection{Merge Conflicts}
361
361
Occasionally when you try to merge or pull changes, you will run into what is called a merge conflict. This usually occurs because you and another person with access to your repository have changed the same files at the same time. This is one of the main reasons we use branches to create our changes. It gives you a little sandbox to play in and make changes before incorporating them with changes others have made. Regardless you are likely to run into merge conflicts more often than not as the team grows. What occurs when you get a merge conflict is that git will add a copy of the conflicting code into your file as a section right below the conflicting code and ask you to pick between the conflicting changes. You can recognize this as it will start with $<<<<<<<$ HEAD, end with the branch you are trying the merge in, and will be separated by equal signs. HEAD is just a signal saying the commit you are located at or the "head" of the commit history has this code and the branch has the other set of code. All you need to do is delete one of the sets of code you don't want and try to merge again. This will auto generate a commit message that says you resolved a merge conflict. I highly suggest you change this message to reflect what happened and what changed.
362
362
363
-
\subsection{Git Log}
364
-
To visualize your commit history, you will enter the command \colorbox{light-gray}{\textbf{git log}}. Alone, this command will produce all of the commits you have made that you can scroll through with the arrow keys. You can leave the log by hitting the q key. Without adding flags to the command however, the log is not very informative which is why I have created the long alias shown above. A simple way you can also make the output informative is by adding the \colorbox{light-gray}{\textbf{- -oneline}}, \colorbox{light-gray}{\textbf{- -pretty}}, and \colorbox{light-gray}{\textbf{- -graph}} flags to make the output nicer and show a graph of the changes over time.
365
-
366
-
When looking at the commit history, you may notice that all of the commits have this long list of numbers and letters. This is the unique identifying SHA value of the commit. There is no other commit on earth that will have the same SHA value as yours. As a result, you can actually go back to previous commits by checking out commit by this number. You will usually only need the first five or six places of this number to check it out. You just need enough for it to be unique in your repository. In fact you may notice that on GitHub, your commits are only shown with this shortened form of the SHA value when looking at the commit history.
367
-
368
-
Remembering these SHA values is difficult, which is why we can also tag specific commits as significant points to go back to.
363
+
\subsection{Git Log}
364
+
To visualize your commit history, you will enter the command \colorbox{light-gray}{\textbf{git log}}. Alone, this command will produce all of the commits you have made that you can scroll through with the arrow keys. You can leave the log by hitting the q key. Without adding flags to the command however, the log is not very informative which is why I have created the long alias shown above. A simple way you can also make the output informative is by adding the \colorbox{light-gray}{\textbf{- -oneline}}, \colorbox{light-gray}{\textbf{- -pretty}}, and \colorbox{light-gray}{\textbf{- -graph}} flags to make the output nicer and show a graph of the changes over time.
365
+
366
+
When looking at the commit history, you may notice that all of the commits have this long list of numbers and letters. This is the unique identifying SHA value of the commit. There is no other commit on earth that will have the same SHA value as yours. As a result, you can actually go back to previous commits by checking out commit by this number. You will usually only need the first five or six places of this number to check it out. You just need enough for it to be unique in your repository. In fact you may notice that on GitHub, your commits are only shown with this shortened form of the SHA value when looking at the commit history.
367
+
368
+
Remembering these SHA values is difficult, which is why we can also tag specific commits as significant points to go back to.
369
+
370
+
\subsection{Git Diff}
371
+
Often, you will want to see what changes have been made to a file, branch, or repository as a whole. Usually, you will use \colorbox{light-gray}{\textbf{git diff}} on its own to see what the uncommited changes change in the code. You can also use the diff command with two branches to compare those changes using \colorbox{light-gray}{\textbf{git diff branch1..branch2}}. Refer to this \href{https://www.atlassian.com/git/tutorials/saving-changes/git-diff#:~:text=git%20diff%20is%20a%20multi,%2C%20branches%2C%20files%20and%20more.&text=The%20git%20diff%20command%20is,state%20of%20a%20Git%20repo.}{guide} for more information on git diff.
369
372
370
373
\subsection{Creating Tags or Releases}
371
374
You can tag the commit you are currently on by entering \colorbox{light-gray}{\textbf{git tag}} followed by the tag name. This tag will then also show up when entering \colorbox{light-gray}{\textbf{git log}}.
0 commit comments