Forum > General

Two git questions

(1/1)

lagprogramming:
1. A fpc instance has been downloaded using the following command:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---git clone https://gitlab.com/freepascal.org/fpc/source.git fpc2. After that, the sources have been prepared in order to be modified using

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---git checkout -b patch3. A patch is created using

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---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:

--- 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
--- End quote ---

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.

Martin_fr:
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

Navigation

[0] Message Index

Go to full version