Submitting changes with GIT

HTTPS –> SSH

time to switch from HTTPS to SSH,

    git remote -v
    git remote set-url origin git@github.com:ACCOUNT/REPO.git

you may check your SSH keys' fingerprints against those you have recorded at GitHub,

    ssh-keygen -E md5 -lf ~/.ssh/id_*.pub

Basic usage

review the files that have been changed,

    git status

and commit,

    git commit -a

review what is going to be pushed,

    git diff --stat --cached origin/master

and push,

    git push

Create your own branch

first, choose the branch you want to pick from,

    git checkout release-1

then create yours,

    git branch release-1-with-my-feature
    git checkout release-1-with-my-feature

finally commit and eventually push your changes.

Loosing track of a folder

to loose track of a folder – to work on it without playing with GIT,

    git rm -r --cached folder/
    git commit -m "Removed folder from repository"
    git push origin master

Start over.

re-fetch locally deleted or missing files,

    git ls-files -d -z | xargs -0 git checkout --

Merging

create a minor branch against release v1 for you and others to commit,

    git checkout release-1
    git branch release-1.1.0
    git checkout release-1.1.0

merge your changes into the new minor branch,

    git merge release-1-with-my-feature

note. merge --no-ff if you like.

If you got this error,

    error: Pull is not possible because you have unmerged files.

==> edit the file to proceed with the manual merge (see >>>>> lines…) and then,

    git add manually_merged
    git commit

Troubleshooting

How can I see what I am about to push with git? https://stackoverflow.com/questions/3636914/how-can-i-see-what-i-am-about-to-push-with-git

Dealing with CRLF

This might be worth a look as for dealing with CRLF: https://help.github.com/articles/dealing-with-line-endings/

Recovering a broken repository

Take over a broken local repo (commit during battery fallout):


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun