git repos with numerous people

A forum for general discussion of the Python programming language.

git repos with numerous people

Postby metulburr » Mon Jul 01, 2013 10:49 pm

I thought i had it all figured out, but one question still remains. What happens when you pull the repo, make some changes, while in the middle of this, someone else pushes to this repo? At that point you are not able to push until you pull again to update with the repo. Doesn't pulling just essentially download the repo again?

For example: At that point when you push to the repo it looks to be denied as you dont have the lastest. At this stage, i copied the work i did for backup. Then I pulled the repo again. In which it thinks there was no changes to be made. So i add an empty line to make a change. Then push it. At that point i think i did it right, for the exception in the log it did both. So if you push the repo when you dont have the latest, what the difference as it pushed it anyways?

I mean its not a big deal. It would be nice to know. It would also be nice to not have a bunch of changes with an extra empty line as the only change, because you dont know if it pushed or not.
New Users, Read This
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
steam
User avatar
metulburr
 
Posts: 1415
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: git repos with numerous people

Postby Yoriz » Mon Jul 01, 2013 11:18 pm

I'm not expert with git (wonders what i am expert with :? )
From git help see the part i've underline and bolded
https://help.github.com/articles/fork-a-repo#pull-in-upstream-changes

Pull in upstream changes

If the original repository you forked your project from gets updated, you can add those updates to your fork by running the following code:

git fetch upstream
# Fetches any new changes from the original repository
git merge upstream/master
# Merges any changes fetched into your working files

What is the difference between fetch and pull?

There are two ways to get commits from a remote repository or branch: git fetch and git pull. While they might seem similar at first, there are distinct differences you should consider.
Pull

git pull upstream
# Pulls commits from 'upstream' and stores them in the local repository

When you use git pull, git tries to automatically do your work for you. It is context sensitive, so git will merge any pulled commits into the branch you are currently working in. One thing to keep in mind is that git pull automatically merges the commits without letting you review them first. If you don't closely manage your branches you may run into frequent conflicts.

Fetch & Merge

git fetch upstream
# Fetches any new commits from the original repository
git merge upstream/master
# Merges any fetched commits into your working files

When you git fetch, git retrieves any commits from the target remote that you do not have and stores them in your local repository. However, it does not merge them with your current branch. This is particularly useful if you need to keep your repository up to date but are working on something that might break if you update your files. To integrate the commits into your local branch, you use git merge. This combines the specified branches and prompts you if there are any conflicts.
New Users, Read This
Join the #python-forum IRC channel on irc.freenode.net!
Spam topic disapproval technician
Windows7, Python 2.7.4., WxPython 2.9.5.0., some Python 3.3
User avatar
Yoriz
 
Posts: 782
Joined: Fri Feb 08, 2013 1:35 am
Location: UK

Re: git repos with numerous people

Postby metulburr » Sun Jul 07, 2013 3:53 pm

ok thanks yoriz

another question regarding specifically to github:
Why do i push things to repos buy it doesn't appear to update my contributions? Well sometimes it does and sometimes it doesnt.
New Users, Read This
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
steam
User avatar
metulburr
 
Posts: 1415
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY


Return to General Discussions

Who is online

Users browsing this forum: No registered users and 3 guests