SANS@Tools
SANS@ToDo
SANS@MLZ
Useful Links
A new commit:
git status git add ... list of files ... git commit # one line about this commit git commit --amend # full information about this commit git push origin master # publish this commit
Modify last commit:
git add ... list of files ... git commit --amend # modify information about this commit git push -f
Rebase to Master:
git fetch git rebase origin/master
Rebase to Master, if local git-code ahead:
git fetch git stash git rebase origin/master git stash pop
#cd folder with docker file docker build -t test . docker images docker run --rm -it --entrypoint /bin/bash test # start image with bash docker image rm test # remove image "test"
Reset local git to the remote version
git stash git reset --hard upstream/master git stash pop
Local git-log
git log --pretty=oneline
Reset hard or soft
git reset --hard 8f02f28efccc879d7c4efcf8483f044de0c04783 git reset --hard HEAD~1 git reset --hard HEAD~19 git reset --hard origin/master git reset --soft HEAD~1 git reset --soft HEAD~20
Add remote upstream repository:
git remote add upstream gitlab@iffgit.fz-juelich.de:qtisas/qtisas.git
Restore staged changes
git restore --staged .
Restore a file to remote status
git restore README.rst
Force a push that would otherwise be blocked, usually because it will delete or overwrite existing commits (Use with caution!)
git push -f
git reset –soft
For instance, if we realize that we forgot to add a file to the commit, we can move back using the –soft with respect to the following format: git reset –soft HEAD~n to move back to the commit with a specific reference (n). git reset –soft HEAD~1 gets back to the last commit.
git reset --soft HEAD~1 git reset --soft HEAD~20
The git reset –hard
is a Git command used to reset the current branch to a previous commit, discarding any local changes and modifications made to the files. The –hard option stands for “hard reset” and is used to forcefully discard any local changes and modifications made to the files.
git reset --hard 8f02f28efccc879d7c4efcf8483f044de0c04783 git reset --hard HEAD~1 git reset --hard HEAD~19
“Cancel” several last commits. Example
git reset --soft HEAD~1 git status git restore --staged qtisas/sans/dan/dan18-init.cpp git status git reset --soft HEAD~1 git status git restore --staged qtisas/sans/dan/dan.ui git status git log --pretty=oneline git stash git status git log --pretty=oneline git reset --hard 0024de9ebeab936fafe905850095280dfa247d5e git push -f
Interactive rebase: modify a previous commit (in the example> HEAD~2) qtisas/sans/xxx/yyy.cpp file
git stash git rebase -i HEAD~2 # change "pick" to "edit" for modified commit git stash pop git status git add qtisas/sans/xxx/yyy.cpp git commit --amend git stash git rebase --continue git stash pop git push -f
Update Docker container (all containers are here: https://iffgit.fz-juelich.de/qtisas/qtisas/container_registry/421):
cd ci/bionic. # locally docker login iffregistry.fz-juelich.de # login/password docker build -t iffregistry.fz-juelich.de/qtisas/qtisas:bionic-0.0.7 . # 7: next version, docker push iffregistry.fz-juelich.de/qtisas/qtisas:bionic-0.0.7
If local hash of previous commit is different from remote one:
git reset --soft HEAD~1 git restore --staged ...all staged files of newest commit... git stash git fetch git rebase origin/master git stash pop ... and re-submit newest commit
Submit release request/commit:
git fetch --tags (check: 'git tag', alternative if no tags: git fetch --tags --all) /usr/bin/python3 scripts/release.py patch git push origin master # send merge request
Rebase to upstream, if master and upstream are diverged
git remote add upstream https://iffgit.fz-juelich.de/qtisas/qtisas.git git fetch upstream git rebase upstream/master git push -f origin master
git-web/master: create merge request master→upstream
qtisas@windows@NoPython
cmake.exe .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM="C:/Qt/Tools/mingw810_64/bin/mingw32-make.exe" -DCMAKE_C_COMPILER="C:/Qt/Tools/mingw810_64/bin/gcc.exe" -DCMAKE_CXX_COMPILER="C:/Qt/Tools/mingw810_64/bin/g++.exe" -DHDF5_ROOT="C:/LIBS/mingw810_64/hdf5" -DTIFF_ROOT="C:/LIBS/mingw810_64/tiff" -Dyaml-cpp_ROOT="C:/LIBS/mingw810_64/yaml_cpp" -DZLIB_ROOT="C:/LIBS/mingw810_64/zlib" -DCMAKE_PREFIX_PATH="C:/Qt/5.15.2/mingw81_64" -DWITH_PYTHON=OFF
re-build qtiSAS (in ./build folder):
rm -rf ../build/* rm -rf ../bin/venv/ rm -rf ../libs/Darwin-arm64/qtexengine rm -rf ../libs/Darwin-arm64/qwt rm -rf ../libs/Darwin-arm64/qwtplot3d rm -rf ../libs/Darwin-arm64/muparser cmake .. -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_PREFIX_PATH=/opt/homebrew/opt/qt -DPython3_ROOT_DIR=/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/Current -DCMAKE_BUILD_TYPE=Release -DWITH_PYTHON=ON cmake --build . --parallel 12