Recent

Author Topic: Two git questions  (Read 647 times)

lagprogramming

  • Sr. Member
  • ****
  • Posts: 406
Two git questions
« on: February 28, 2024, 03:08:33 pm »
1. A fpc instance has been downloaded using the following command:
Code: Pascal  [Select][+][-]
  1. git clone https://gitlab.com/freepascal.org/fpc/source.git fpc
2. After that, the sources have been prepared in order to be modified using
Code: Pascal  [Select][+][-]
  1. git checkout -b patch
3. A patch is created using
Code: Pascal  [Select][+][-]
  1. git diff patchpath.diff

Here are two questions:
a. After writing the patch at step 3, how do I revert back to step one? I mean I want to delete the "patch" branch which contains the modifications and remain with the instance files downloaded at step 1.
b. After some time from downloading files at step 1, what git command do I have to use in order to just update the files to the newest snapshot? I can get the latest snapshot by deleting the files and cloning the sources again, but for sure there's a faster way of doing it.
Thank You!

vfclists

  • Hero Member
  • *****
  • Posts: 1013
    • HowTos Considered Harmful?
Re: Two git questions
« Reply #1 on: February 28, 2024, 04:28:36 pm »
Quote
Here are two questions:
a. After writing the patch at step 3, how do I revert back to step one? I mean I want to delete the "patch" branch which contains the modifications and remain with the instance files downloaded at step 1

This answer to a. is git checkout master or whatever the default branch was.

Most terminals configured with git awaress display the current branch in the prompt.

git branch -a lists all the branches.
Lazarus 3.0/FPC 3.2.2

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9868
  • Debugger - SynEdit - and more
    • wiki
Re: Two git questions
« Reply #2 on: February 28, 2024, 04:34:03 pm »
If you still have uncommitted changes in the working tree (git diff displays a diff / git status shows modified files) then you may want to either first
- commit them
- stash them
- delete them "git reset --hard" (ALL CHANGES WILL BE LOST).

Then a "git checkout main" should get you to the main branch.


2)

To update

git stash
git pull --ff-only
git stash pop


 

TinyPortal © 2005-2018