GIT Notes:



git reset --hard origin/master


MOVE CHANGED FILES TO ANOTHER BRANCH FOR CHECK-IN

# work on some code

git stash

git checkout correct-branch

git stash pop


PULL UNRELATED CHANGES

https://www.educative.io/edpresso/the-fatal-refusing-to-merge-unrelated-histories-git-error

git pull origin master --allow-unrelated-histories


GIT INIT ACTIONS

$ git init

$ git add .

# Adds the files in the local repository and stages them for commit. To unstage a file, use 'git reset HEAD YOUR-FILE'.

$ git commit -m "First commit"

# Commits the tracked changes and prepares them to be pushed to a remote repository. To remove this commit and modify the file, use 'git reset --soft HEAD~1' and commit and add the file again.


# Sets the new remote

$ git remote add origin remote repository URL

# Verifies the new remote URL

$ git remote -v


# Pushes the changes in your local repository up to the remote repository you specified as the origin

$ git push -u origin master


Moving changed files to another branch for check-in.

# work on some code

git stash

git checkout <correct-branch>

git pull

git stash pop

git branch --no-track <correct-branch>

git checkout <correct-branch>

git push -u origin <correct-branch>


 (use "git checkout -- <file>..." to discard changes in working directory)