ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • Git Tips
    Data/Machine learning 2021. 4. 5. 09:54

    .gitignore

    .gitignorefile is a plain text file where each line contains a pattern for files/directories to ignore. You may ignore them for the following reasons: 1) security, 2) size, 3) non-related to a project.

    .gitignore should be located in the root directory.

    Syntax

    [1] www.pluralsight.com/guides/how-to-use-gitignore-file
    [2] programming119.tistory.com/105

    Examples

    1-InitialExperiment/development_test/  # ignore the corresponding directory.
    
    1-InitialExperiment/evaluations/1-TSNE_analysis/images/selected_subsequences/*.png  # ignore all the png files in the corresponding directory.
    1-InitialExperiment/evaluations/1-TSNE_analysis/images/selected_subsequences_FFT/*.png
    
    *.pth  # ignore all .pth files.
    
    .idea/  # ignore all `.idea` directories.
    .ipynb_checkpoints/
    __pycache__/
    

     

    Cancel git add, git commit, or git push

    [1]gmlwjd9405.github.io/2018/05/25/git-add-cancle.html

    Cancel git add

    • git reset HEAD [file_name]
    • git reset HEAD . # reset all the added items.

    You can check out what's been added by git status

    Cancel git commit

    • git reset HEAD^

    You can check out the commit history by git log

    Cancel git push

    • git reset HEAD^

     

    git add . vs. git add *

    git add . adds all the files/directories, while git add * adds all of them except for files/directories in the root that start with a dot.

     

    Problem-Solution

    1. If you already pushed some files/dirs and then added them in '.gitignore', they won't be removed from GitHub when you git add .. You have to manually remove them from your local repo. and push them to get them removed from GitHub, and you add them on '.gitignore' to make them in the future.

     

    'Data > Machine learning' 카테고리의 다른 글

    What does .eval() do in PyTorch?  (0) 2021.04.14
    W&B Tips  (0) 2021.04.04
    Noise Contrastive Estimation and Negative Sampling  (0) 2021.03.23

    Comments