Git🔗
Cloning and Branching:🔗
Fixing your local Repo:🔗
Reset my local Repo to whatever is online🔗
If people have made many changes and you haven't caught up, it's sometimes easiest to just reset your local folder to whatever is on the server.
For more nuance, see this stack overflow post
git push origin master FAILS🔗
If someone else changed Master
and you haven't received those, you may get an error (probably in red and yellow) that resembles the following:
SOLUTION 1:🔗
Try a simple git pull. If you didn't change the same files that others did then you should receive their changes painlessly.
Bash | |
---|---|
This may get you into the land of Vim, a text editor that lives entirely in the terminal, it's ok to be confused, it happens to most people trying to exit vim.
To escape vim and save the merge, type the follow key cominations: escape
then shift+;
(a colon) then w
then q
then enter
SOLUTION 2:🔗
If the git pull origin master command fails, you may get an error like the following:
This means that you tried to edit the same file that someone has already updated on the master branch of the server.
Opening up your
Broken / Wrong Origin link:🔗
Hard reset all files (fetch other's work)🔗
Fixing the remote Repo:🔗
Pushed wrong files to Gitlab.🔗
Sometimes you have temporary files / images locally that you don't need to push to everyone via Gitlab. Sometimes those images / large files end up in the repo but others don't want to download them when they clone it, so we'll remove them
SOLUTION:🔗
Files and folders listed in .gitignore will not be tracked by git (i.e. you can use git add .
and it won't wrongfully add gitignored files). Learn more on gitignore syntax (https://www.atlassian.com/git/tutorials/saving-changes/gitignore)[here].
After updating .gitignore to list the files you want to remove from remote gitlab,
Bash | |
---|---|
This assumes there are files you need to re-ignore
in folders throughout the project. If it's a single folder (./VERY_FULL_FOLDER/
) or file (./path/to/one_file_to_remove.py
) then you should replace the .
in the first command to that path (i.e. ./VERY_FULL_FOLDER
) and only the files in that folder will be searched.
Created: June 7, 2023