Changes

Jump to navigation Jump to search
180 bytes removed ,  18:39, 1 December 2023
m
Text replacement - "syntaxhighlight" to "pre"
===Clone Repository===
<syntaxhighlight pre lang="shell">
$ git clone git@github.com:$username/$project.git
Cloning into $project...
===List Remote Repositories===
<syntaxhighlight pre lang="shell">
$ git remote -v
origin git@github.com:$username/$project.git (fetch)
After some files have been changed locally, the changes can be seen as follows:
<syntaxhighlight pre lang="shell">
$ git diff
diff --git a/readme.txt b/readme.txt
First, it is needed to select the modified files which should be committed:
<syntaxhighlight pre lang="shell">
$ git add readme.txt
</pre>
Then perform the actual commit:
<syntaxhighlight pre lang="shell">
$ git commit
[master 0fde1fb] Added TODO in section "USING GIT"
Alternative way is to commit all changed files, i. e. it is not needed to explicitly add the changed files:
<syntaxhighlight pre lang="shell">
$ git commit -a
[master 0fde1fb] Added TODO in section "USING GIT"
===Pushing Changes to Remote Repository===
<syntaxhighlight pre lang="shell">
$ git push
Enter passphrase for key '/home/user/.ssh/id_rsa':
===Pulling Changes from Remote Repository===
<syntaxhighlight pre lang="shell">
$ git pull
Enter passphrase for key '/home/user/.ssh/id_rsa':
The upstream repository is the one from which the BaseX releases are made and the one from which the personal repository was forked.
<syntaxhighlight pre lang="shell">
$ git remote add upstream git@github.com:BaseXdb/$project.git
When some changes are made in the upstream repository, they can be pulled to the local repository as follows:
<syntaxhighlight pre lang="shell">
$ git pull upstream master
Enter passphrase for key '/home/user/.ssh/id_rsa':
The changes can then be pushed in the personal repository:
<syntaxhighlight pre lang="shell">
$ git push
</pre>
It is always a good idea to create a new branch for a new feature or a big fix you are working on. So first, let's make sure you have the most up-to-date source code. We assume, that you added BaseX as upstream repository as described above and you are currently in the ''master'' branch:
<syntaxhighlight pre lang="shell">
$ git pull upstream master
</pre>
Now, we create a new branch, based on the master branch
<syntaxhighlight pre lang="shell">
$ git checkout -b new-feature
Switched to a new branch 'new-feature'
Your are now automatically switched to the ''new-feature'' branch. Now you can make all your changes in one or several commits. You can commit all changes using
<syntaxhighlight pre lang="shell">
$ git commit -a
</pre>
Now, you want to push these changes to the repository on GitHub. Remember, that up to now your changes just reside on your local drive, so now you want to push it to your remote fork of BaseX. Simply do:
<syntaxhighlight pre lang="shell">
$ git push origin new-feature
Counting objects: 318, done.
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu