Skip to content

Instantly share code, notes, and snippets.

@2xyo
Last active November 13, 2020 17:16
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save 2xyo/89275fb16782bd301a44dd8878fa0979 to your computer and use it in GitHub Desktop.
Mémo GIT
$ git --version
git version 2.25.1
$ python3 --version
Python 3.8.5

Fork the project and clone your repository

$ git clone  https://github.com/<youraccount>/client-python.git
``

Prepare an isolated dev environnement 
```console

$ git clone  https://github.com/2xyo/client-python.git pycti_fork
$ cd pycti_fork
$ git remote add upstream https://github.com/OpenCTI-Platform/client-python.git
$ git remote -v
$ git remote -v
origin  https://github.com/2xyo/client-python.git (fetch)
origin  https://github.com/2xyo/client-python.git (push)
upstream        https://github.com/OpenCTI-Platform/client-python.git (fetch)
upstream        https://github.com/OpenCTI-Platform/client-python.git (push)

# Fetch from upstream remote
$ git fetch upstream

# View all branches, including those from upstream
k$ git branch -va
* master                                  2224a05 [client] Add the forceNatural option to relation methods
  remotes/origin/HEAD                     -> origin/master
  remotes/origin/issue/296                f0ab289 Introduce API for state management in connector
  remotes/origin/master                   2224a05 [client] Add the forceNatural option to relation methods
  remotes/origin/patch-1                  c442bac Implement HTTP keep-alive
  remotes/origin/patch-2                  212d2d3 Use a minimal version rather than a specific version for install_requires
  remotes/origin/patch-3                  3bc3204 Update .gitignore with more directories
  remotes/origin/pyup-initial-update      46c1743 Pin python-magic to latest version 0.4.18
  remotes/origin/sphinx-autodoc-typehints c4010a9 Add sphinx-autodoc-typehints to use Python 3 annotations for documenting argument types
  remotes/origin/wheel                    9d6b96e Merge branch 'master' into wheel
  remotes/upstream/issue/78               66f0622 Merge branch 'master' of https://github.com/OpenCTI-Platform/client-python into issue/78
  remotes/upstream/master                 1f13ff1 [client] Fix Courses Of Action list
  remotes/upstream/rha/add-pytest         ca94a02 Fix black formatting
  
# Checkout your master branch and merge upstream
$ git checkout master
$ git merge upstream/master


# Checkout the master branch - you want your new branch to come from master
$ git checkout master

# Create a new branch named newfeature (give your branch its own simple informative name)
$ git checkout -b  feature-branch-name

$ python3 -m venv  .venv_p
source .venv/bin/activate
pip install --upgrade pip wheel
pip insatll -e .[dev,doc]

do stuff
git add <files>
git commit -m "hack"
..
git add <files>
git commit -m "hack again"


git merge-base new-branch master

git rebase -i <hash>
git push origin feature-branch-name
``

DOC https://gist.github.com/Chaser324/ce0505fbed06b947d962
git clone git@github.com:2xyo/client-python.git client-python-wheel
cd client-python-wheel
git remote add upstream https://github.com/OpenCTI-Platform/client-python.git
git remote -v
# Fetch from upstream remote
git fetch upstream
# View all branches, including those from upstream
git branch -va
# Checkout your master branch and merge upstream
git checkout master
git merge upstream/master
# Checkout the master branch - you want your new branch to come from master
git checkout master
# Create a new branch named newfeature (give your branch its own simple informative name)
git checkout -b wheel
cd ..
python3 -m venv client-python-wheel-venv
source client-python-wheel-venv/bin/activate
cd client-python-wheel
pip install -U pip pep517 twine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment