Everyone should use Git and GitHub?

Discussion about the Panlexia project
tok a tema of de panlexia projet
seweli
Posts: 46
Joined: 2024-09-29 20:49

Everyone should use Git and GitHub?

Post by seweli »

It's just an introduction to the Git topic.
Both to share good Introduction for dummies and to debate if the Panlexia project should propose other way to contribute.

git - the simple guide
http://rogerdudler.github.io/git-guide/
pandunia-guru
Posts: 47
Joined: 2024-09-28 09:28

Re: Everyone should use Git and GitHub?

Post by pandunia-guru »

The source files of Panlexia are really are in GitHub at https://github.com/barumau/panlexia. All contents are text files, mostly dictionary files (.tsv) or program source code files (.py). They are easy to edit with any text editor or GitHub's own online editor, see https://docs.github.com/en/codespaces/t ... sed-editor.

Currently my own setup is WSL + VSCode (Windows Subsystem for Linux + Visual Studio Code). It's setup in 15 minutes for example by following the instructions in https://www.youtube.com/watch?v=CokQE8kxxHQ. It may look like wizardry for non-programmers but it's not hard. Then start WSL and type the following commands:
# Install Git version control system:
sudo apt-get install git
# Configure yourself as Git user
git config --global user.name "Your Name"
git config --global user.email "youremail@domain.com"
# Download Panlexia workspace to your system:
git clone https://github.com/barumau/panlexia.git
# Open Panlexia workspace in VSCode
code panlexia

From then on you can always start the workspace by typing only code panlexia.

After making changes you need to upload them to GitHub database. You can read a Git guide to understand it better, but here is a simple way to do it:
# Upload latest changes from GitHub
git pull
# Create branch for your changes
git checkout -b my_branch
# Make your changes in VSCode. See your changes by typing:
git diff
# Commit all (-a) your changes with a message (-m):
git commit -a -m "Describe my change"
# Upload your branch to GitHub
git push origin my_branch
seweli
Posts: 46
Joined: 2024-09-29 20:49

Re: Everyone should use Git and GitHub?

Post by seweli »

Will you normalize the coding of the end of line?
To LF or CRLF?
seweli
Posts: 46
Joined: 2024-09-29 20:49

Re: Everyone should use Git and GitHub?

Post by seweli »

Don't you forget the: git add?
pandunia-guru
Posts: 47
Joined: 2024-09-28 09:28

Re: Everyone should use Git and GitHub?

Post by pandunia-guru »

You can configure git to handle line endings. Alternatively you can run dos2unix.

Unfortunately I haven't normalized line endings in Panlexia files yet. They are what they are. :( Fortunately users are not expected to modify any files in the "data" directory. They will modify only language-specific files inside "dict".

You can specify changes with git add or you can commit all changed files with git commit -a.
seweli
Posts: 46
Joined: 2024-09-29 20:49

Re: Everyone should use Git and GitHub?

Post by seweli »

commit -a ?
It looks dangerous 😅
pandunia-guru
Posts: 47
Joined: 2024-09-28 09:28

Re: Everyone should use Git and GitHub?

Post by pandunia-guru »

seweli wrote: 2024-10-17 11:41 commit -a ?
It looks dangerous 😅
It commits only files that are in the Git repository, not any other files. Besides, you can always undo or modify your last commit before you have uploaded/pushed it to GitHub. :)

You can also commit individual files like this:
git commit -m "Describe my changes" file1.tsv file2.py
seweli
Posts: 46
Joined: 2024-09-29 20:49

Re: Everyone should use Git and GitHub?

Post by seweli »

Interesting.
Actually, if i do a "git diff" before, i already see the list of the modified files.
Image
pandunia-guru
Posts: 47
Joined: 2024-09-28 09:28

Re: Everyone should use Git and GitHub?

Post by pandunia-guru »

You can see list of the files you have modified by typing "git status".
seweli
Posts: 46
Joined: 2024-09-29 20:49

Re: Everyone should use Git and GitHub?

Post by seweli »

Thanks.

I finally understand what happened.

To see the new commits I have to use the command:

git log upstream/master..HEAD
Post Reply