Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
|
Thread Tools | Search this Thread | Display Modes |
17th November 2020, 12:58 | #1 | Link |
German doom9/Gleitz SuMo
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,753
|
Updating x265 to a specific revision: git vs. Mercurial
I already asked it once in the x265 encoder thread, but there are still issues, and I don't want to clutter that thread more, so I'll prefer a separate thread.
When x265 used Mercurial (hg), I could use a simple shell script to update my local working directory to either the latest commit in the default branch, or the "tip" regardless of the branch, or a specific commit by checksum. uptodate_x265.sh Code:
#!/bin/sh hg pull --cwd build/x265-hg -r "${1:-default}" hg update --cwd build/x265-hg -r "${1:-default}" I had to learn that I am not able to understand the meaning of all the parameters git offers to achieve the same result. Until today I believed that the following script is able to ensure that my local working directory gets updated to the latest commit in the default branch: uptodate_x265-git.sh Code:
#!/bin/sh git -C build/x265_git-git fetch -v --progress origin git -C build/x265_git-git pull -v --no-rebase --progress origin master So I remain helpless. It would be nice if I could have one script which does the same as my previous one, but won't mind if I have to split it into separate versions to handle default, tip, and revision-by-checksum-parameter in optimal sequences, to avoid complex case switches. |
17th November 2020, 17:49 | #2 | Link |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
In most cases a simple git pull will be sufficient
Anyway, I think the most reliable way to update your local branch to the latest commit (HEAD) of the remote branch is: git fetch --all && git reset --hard origin/master If you want a different branch or a specific commit, replace origin/master with origin/some_branch or just commit_id. Additionally, you may want to run git clean -fdx after the update, in order to get rid of any old cruft. Note that git pull is just a shorthand for git fetch followed by git merge FETCH_HEAD. In other words, it first fetches the latest changes from the remote tracking branch and then merges them into your local branch. This will create additional "merge" commits in your local branch, unless the merge is purely fast forward. These merge commits obviously won't exist on the remote. Also, the merge can fail for various reasons. With the "git fetch plus git reset --hard" method you throw away the local changes (if any) and simply reset your local branch to the HEAD of the remote. It will not try to merge anything, which probably is what you want here. Using a GUI like "Tortoise Git" can help to make things more obvious: https://i.imgur.com/m7W3xRB.png
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 17th November 2020 at 18:19. |
17th November 2020, 23:00 | #3 | Link |
German doom9/Gleitz SuMo
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,753
|
I want to run it semi-automated in scripts in the MinGW shells of MABS. So I will test your suggestions soonish...
I will always only retrieve from the distant repo to my local working directory, revoking local changes will be intended. Last edited by LigH; 17th November 2020 at 23:03. |
17th November 2020, 23:07 | #4 | Link |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Then I'd suggest either rm -rf the existing directory and do a fresh git clone or, as was suggested before, do git fetch followed by git reset --hard (followed by git clean -fdx)
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 18th November 2020 at 17:56. |
Thread Tools | Search this Thread |
Display Modes | |
|
|