New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
user/techene/githint – NEMO
wiki:user/techene/githint

Version 7 (modified by techene, 2 years ago) (diff)

--

Une métaphore amusante consiste à considérer Git comme un utilitaire de gestion des chronologies.

Where am I ? Bash hint !

parse_git_branch() {
     git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "

https://git-scm.com/docs/git-commit
https://www.atlassian.com/fr/git/tutorials/undoing-changes

Useful commands

git-checkout

git checkout MY_BRANCH - Switch branches or 
git checkout old_commited_files.F90 restore working tree files
https://git-scm.com/docs/git-checkout

git-restore

git restore deleted_file.F90 Restore working tree files
git restore --source MY_BRANCH~2 file_before_last_2_commit.F90
https://git-scm.com/docs/git-restore

Process

git stash
emacs file.F90
git add file.F90
git commit -m 'comment' 
git status 
git diff dev_2021_rk3 remotes/origin/dev_2021_rk3
git push

Create a branch post commit

git clone xxx
git switch main
emacs files.F90
git add file.F90
git commit -m 'comments'
git log 
git checkout #sha
git branch MY_BRANCH
git switch MY_BRANCH
git merge main (modified)
git push --set-upstream origin MY_BRANCH