I'm fairly new to programming and thought I'd try out version control. I created a GitHub account to help me track my journey of creating my first webpage.
I want to upload updated versions of my code as I go along (e.g. Stage1, then perhaps when I progress a little further Stage2, then Stage 3 etc). This would essentially be the same file of code but each time it will be added to/ edited slightly.
Could someone advise me as to how to do this?
Thank you! :)
Every commit you push to your repository is stored and then you can access every version that you have committed afterward.
Just go into your repo, click at your commits tab:
Commits Tab
Then you can access the version by clicking the commit hash you desire to browse:
Commit hash abbreviated
After this, you just click in browse files.
If you want to use in your computer another version, you just have to git checkout 'commit hash' inside your folder at sync with your git repo.
Related
I see this message below my repo name. Is there any way to remove it? I used template for my app for a quick start, but in current form my app doesn't look like this template, because everything changed so much. I don't see any reason why it's still there.
I had the same problem and at the time for writing this answer, there is no option of removing this from Github. So removed this tag by deleting the repository from Github and recreating a new one with the same name.
⚠️ This operation will preserve only the information stored in git, not all other Github features, i.e. issues, PRs, ... If your repository has been used for a while, this might not be the right time to do this anymore.
Specific instructions:
Make sure you have cloned your repository and all your non-stale branches are saved locally.
git fetch
Delete the original repository in the Github web UI.
Create a new repository with the same name.
Push the branches you want back to the remote.
git push
Recently, we have started a group project and decided to use GitHub to share the code among ourselves.
For example, if I created a login page and my friend created a home page, how can I get it on my local machine.
I mean, whenever a change is made to the repo, do we need to download it all again?
The beauty of GitHub is that you can always go back whenever you feel like.
Whenever a changed is made by any of the teammate, it's a really good practice that you push that change. Even when it's a small one. After you've pushed your changes, your teammates would need to pull that change.
The best sequence for this is;
- git commit
- git pull
- git push
You'll have to pull the changes first as it would help you avoid getting merge conflicts. If you get any merge conflicts on any line, or any function, you'll resolve that conflict and follow the same sequence once again.
So, to conclude, GitHub is so easy to use and you won't have to necessary 'Download' all the changes once again. I would recommend you to setup via Visual Studio 2019 so that it becomes easier for you to just "pull" the changes whenever a new change has been made.
I'm new to github and currently only starting off using github for mac.
I have taken a clone of my client's website and made some development changes locally. Note: I'm literally working with the files in the directory I sync with.
I want to push only one small change as the rest is still under development. Is it possible to push only the one file?
Git pushes deal with commits, not files. You'll need to create a commit that contains your selected changes. This is one area where Git's index is really handy.
Let's say you've modified two files, foo and bar.
If you want to commit only the changes to foo, using the command line you can do
git add foo
git commit
This will create a new commit updating foo, but bar's changes will remain only in your working copy. You can now push the new commit.
It's been a while since I've used the graphical GitHub tools, and I've only used them on Windows, but I believe the way to commit only certain files is to check or uncheck the box beside each file before you commit. You can see these checkboxes in their documentation:
You can go even further. If some of the changes in bar should be part of a commit, but not all of them, you can do something like git add --patch, which will break your changes up into chunks and prompt you for the ones to add to the index (these are the ones that will be included when you commit).
On GitHub for Mac you can do this too:
Select one or more lines to commit by clicking on the line numbers in the gutter. In the latest release, you can select a block of changes at a time. Hover over the right hand side of the line numbers to get a preview of what will be selected, and click to select.
See the documentation for git-add for details.
I just started using github.com and my friend and I are working on a project. How can I pull parts of the project but check out certain files I'm working on so he doesn't work on them. He can still download the files but he won't be able to open or edit them until I upload them back and give permission?
I suppose you mean lock a file when you edit it. Git won't let you do this and it's not something you need to worry about. Instead, you can both work on the same file and then merge your changes later.
If you really want to work that way (i.e: lock files, or at least control when your friend will modify your repo), you can ask your friend to fork your repo.
That way, he/she:
will have his/her own copy of said repo
will work on any file
will rebase first with branches fetched from your repo (added as a remote on his/her fork, as described in GitHub: working with remotes)
will make pull request, allowing to decide what to include and when.
Historically version control systems provide a checkin/checkout feature. When you do a checkout, you reserve the artifact. If another person also has the same file checked out, then you get an error when trying to checkin the artifact. Not sure creating another fork is really the equivale
Anybody describe me with the example and step by step operation about how to branch a code and then after branching how to merge back the changes in main code.
Thanks & Regards,
Hussain
To branch right click drag the project you want to branch to it's new location. A dialog will pop up, select the 'Share and Branch' option, another dialog will pop up, check Recursive (assuming you have some sub folders) then click OK and wait.
Reference here: http://msdn.microsoft.com/en-US/library/xbxd2h7b(v=vs.80).aspx
Merging (which I've never had to do) reference is here: http://msdn.microsoft.com/en-US/library/ms181073(v=vs.80).aspx
There is no branching is VSS. All work is done on the main trunk. Use a better version control tool if you can.
What you could do, if you felt so inclined, is:
Branching
Get the latest version of the code of the project you want to branch
Create a new VSS project
Copy your code into the working folder of the new project (this is your new "branch")
Make your changes
Commit them into the new project
Merging
Take the code of your branch and copy it into the folder holding the latest version of the original project.
Hope no one else had the original project checked out
Commit the changes
I don't recommend this.