Pages

Showing posts with label git. Show all posts
Showing posts with label git. Show all posts

Saturday, October 16, 2021

Reminder : undo git add command


Just to remember a simple command...

Add a file in order to be managed by GIT : 

git add filename

If you want to undo the git add command  :

git reset file

Saturday, June 12, 2021

Git : How to unversionned files ?

Sometimes, I commit files I don't want.This reminder explain how to remove theses files from GIT.

First, you can list files managed by your GIT repositories :

git ls-files => list des fichiers versionnés
git rm --cached .idea

Then, you have to delete unwanted files.In my case, I commited the .idea directory :

git rm -r --cached .idea
rm '.idea/$CACHE_FILE$'
rm '.idea/.gitignore'
rm '.idea/misc.xml'
rm '.idea/modules.xml'
rm '.idea/php.xml'
rm '.idea/vcs.xml'
rm '.idea/yuzu.iml'

If you check the status, you are going to see delete files :

git status
On branch master
Your branch is up to date with 'origin/master'.
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)
        deleted:    .idea/$CACHE_FILE$
        deleted:    .idea/.gitignore
        deleted:    .idea/misc.xml
        deleted:    .idea/modules.xml
        deleted:    .idea/php.xml
        deleted:    .idea/vcs.xml
        deleted:    .idea/yuzu.iml

You only have to execute the commit command : git commit -m "Delete unwanted files"

The last step is to add the unwanted files or directory in the .gitignore file (.idea in my case) :

vi .gitignore 
.idea


GIT : version 2.17.0.windows.1

Tuesday, June 8, 2021

Git : How to recover your files after an improper handling ?

This small reminder permits to recover your project files very quickly without making an git clone.
For example, I use it if I delete files.

First stash your modifications :

git stash save "Bad manip"

git stash list

stash@{0}: On master: Bad manip
stash@{1}: On master: Menu publication

Then, you can delete your bad stash :

git stash drop stash@{0}

Dropped stash@{0} (838f86a5ea1ebb875f34adb1dd6fda9f1b6c89c3)

git stash list

stash@{0}: On master: Menu publication

That's all !

Feel free to comment.


GIT : version 2.17.0.windows.1

Thursday, October 26, 2017

Reminder : GIT config


Some GIT command often used :


git config --global user.email "your_github_email_@email.com"
git config –-global user.name NEWUSER
git config user.name NEWUSER
git remote set-url origin "https://user@git.fr/project/project.git"

git config --unset-all credential.helper (clean user and password)
git config --system --unset-all credential.helper (clean user and password)

Wednesday, October 18, 2017

Reminder : GIT DEBUG mode


My push to a remote repository doesn't work.To identify the issue, I used the following :


GIT_TRACE=2 GIT_CURL_VERBOSE=1 git push -v --set-upstream origin mybranch


Thanks to https://devopshero.wordpress.com/2013/06/19/git-trick-git_trace-1/

PlayConsole : suppression des warnings lors de la publication (minify, symbole de debogage...)

Lors de la publication des versions dans la PlayConsole, j'avais 2 warnings pour indiquer qu'il était possible de réduire et d'o...