Check and download difference. - github

I want check github repo and if is difference - download it.
How I can make it?
I will write bash script for it, but I can not find information about repo difference.

If you have a local repo linked to a GitHub remote repo which might have evolved, you can download and compare the difference with:
cd /path/to/local/repo
git fetch
git diff master origin/master

Related

Remote -v is not returning any information about the git repository

relatively inexperienced git user here, but I have an issue where the command git remote -v is not returning any information about the git repository that I forked from GitHub. I have .git running in the folder and it is an exact replica of the one I have in my GitHub account. The original was forked from a coding school (the files contain practice problems). Right now I'm trying to push back to the repository but that isn't working either.
Any help would be greatly appreciated!
Try again and clone your fork with a git clone https://github.com/<me>/<myfork>
Then go into the myfork folder created by the git clone, and check that git remote -v does return the correct origin URL.

Make the current commit the only (initial) commit in a Git repository that was created with GitHub Desktop

I created my first GitHub repository using GitHub Desktop (Windows). It is a real mess with many revisions that are quite meaningless and some versions of files that I would rather were never uploaded. This was the result of a lot of experimenting to get the feel for how things would appear on GitHub. I want to get rid of all the history versions.
I am tempted to just copy my files on my drive to another folder then delete the repository folder from my drive. Also delete it from GitHub.
Then create a new repository with GitHub Desktop, perhaps with the same name or with a different name then rename it to the original. Could it be a simple as that or will GitHub still retain the files somewhere?
I haven't tried this because in my searching I keep finding all the complex steps to be performed to remove histories or remove files.
I sort of feel that what I am proposing is too simple.
Any opinions?
All of this got too confusing.
I just did what I said in the start of the thread.
It seems GitHub Desktop has some Username/Password problem and won't let me "Publish branch".
So I went to GitHub and created a new repository and uploaded all the files from my local folder.
It looks good to me.
There may be problems in the future. I guess I'll cross that bridge when (if) I come to it.
An alternative approach is to switch to command line and:
delete the .git folder in your repository
recreate it (git init .)
reset the origin remote: git remote add origin https://github.com//
Make a first commit with your current content:
git add .
git commit -m "first commit"
overwrite everything on the remote repo
git push --force -u origin master
The end result will be the same repo but with only one commit.
You can then switch back to GitHub Desktop.
From here.
First make sure you have Git for Windows installed, you are going to need to do git commands manually sooner or later.
Go to your local repository on your computer where your project is located. It's a good idea to show hidden files so you can see that you have the .git-folder and that the .gitignore-file is in place.
Go to the folder where the .git-folder is, right-click and click git bash here.
Now enter these commands:
Create Orphan Branch – Create a new orphan branch in git repository. The newly created branch will not show in ‘git branch’ command.
git checkout --orphan temp_branch
Add Files to Branch – Now add all files to newly created branch and commit them using following commands. Don't forget .gitignore!
git add .
git commit -m "the first commit"
Delete master Branch – Now you can delete the master branch from your git repository.
git branch -D master
Rename Current Branch – After deleting the master branch, let’s rename newly created branch name to master.
git branch -m master
Push Changes – You have completed the changes to your local git repository. Finally, push your changes to the remote (Github) repository forcefully.
git push -f origin master
Git overview

Github folder not being committed fully

Sadly I've been at it for 3 hours trying to commit my assignment which is a single folder... This is my private github repo
I can't drag the folder since it's limited at 100 files apparently there's like 4000 in my folder?
What I've done is:
$ git clone githuburl
(i now dragged my assignment folder to this repo in my own pc)
$ git add assignmentfolder (pages)
$ git commit -m "first commit"
$ git push origin master
And as you can see it straight up ignored every single file and just committed the folder name?
I think the proper way to do this is:
git clone githuburl
cd githubfoldername
then move all your files there
add a .gitignore file there and exclude node_modules and everything else that has to do with caching and external packages because you don't need them in your repo. Everyone who is going to use your code will be able to install the packages as you did. Just make sure you include the:
packages.json if you used npm
or yarn.lock if you used yarn
Then you can safely
git add --all
git commit -m "your message"
This way you will avoid adding useless files to your repo as #Dmitri Sandler said and you will be able to push everything easily
Generally you should think about files not folders. Try to use wildcard in the path:
git add <folder>/*
It is a good idea to use git status to see what files were staged for commit prior to committing them.

Undo a clone in pythonanywhere

I have used git clone to clone a repository from GitHub. Now i have made some changes to that same repository, I want to clone it again, but Python anywhere has saved the earlier cloned repository and not allowing me to clone the updated one. Is there a way to undo/delete the earlier clone and copy the updated repository.
rm -rf cloned-repo is one way.
most likely though, you maybe want to just do a git pull? Or a git reset --hard and then git pull?
ps: I would suggest reading up on how git works.
My files were correct on local system and GitHub, but not on PythonAnywhere. What worked for me is the following:
Go to BASH Console on PythonAnywhere. Enter the command:
rm -rf <your-repo-name.pythonanywhere.com>
Go to Dashboard -> Accounts -> API Token -> Revoke and Generate new API Token (I am not sure if this is required, but I did it just in case)
Now you can get repository from GitHub to PythonAnywhere by NUKING the old running domain
pa_autoconfigure_django.py https://github.com/username/repo.git --nuke
Your github files will be now in pythonanywhere. And Virtual Environment will be created in the Bash console

What does it mean "to fetch" before I can push?

I uploaded my whole project on my repository of github yesterday.
I'd like to update the online version today, and when I use git push -u origin masterorder, the bash window says:
! [rejected] master -> master (fetch first)
So how do I "fetch"?
If I use git pull first, would my local files be overwritten by the online version?
So how do I "fetch"?
By using the command:
git fetch
Basically, your local repo is out of sync with the remote (Github) repository. If you have multiple remote repos, you can specify which one, and you can also specify which branch. Try
git help fetch
for a complete description of the command and the various parameters you can pass in.
If I use git pull first, would my local files be overwritten by the online version?
git pull is like doing a git fetch followed by git merge -- that is, it gets the updates from the remote and attempts to merge those into your local files. That may be fine, or not, depending on what you intend. Read the help for both commands so that you can make an informed decision.